Skip to content

CLI prints blank Error for Blueprint runPHP fatal #3614

@chubes4

Description

@chubes4

Summary

wp-playground-cli run-blueprint can collapse a Blueprint runPHP fatal into a blank CLI error:

Error:

The PHP failure does happen and the process exits non-zero, but the CLI formatter drops the useful cause chain when the top-level Error has an empty message.

Minimal reproduction

Save this as fatal-runphp.json:

{
  "steps": [
    {
      "step": "runPHP",
      "code": "<?php require_once '/wordpress/wp-load.php'; playground_cli_missing_probe_function();"
    }
  ]
}

Run:

wp-playground-cli run-blueprint --blueprint fatal-runphp.json --wp latest --php 8.3 --verbosity=debug

Expected result

The CLI should surface the Blueprint step failure and PHP fatal details, e.g.:

Error: Error when executing the blueprint step #1: PHP.run() failed with exit code 255.

=== Stdout ===
Fatal error: Uncaught Error: Call to undefined function playground_cli_missing_probe_function()

Actual result

Error:

Evidence

A reusable Homeboy rig was added to reproduce and measure this path:

Baseline metrics:

control_exit_code=0
fatal_exit_code=1
fatal_blank_error=1
fatal_has_php_diagnostic=0

The control Blueprint proves the CLI/Blueprint path is otherwise functional. The fatal Blueprint proves the command exits non-zero but does not expose PHP diagnostics.

A candidate formatter-only fix was verified with the same rig:

  • Candidate run: 52652822-759d-438c-a56e-8d4b6605dc33

Candidate metrics:

control_exit_code=0
fatal_exit_code=1
fatal_blank_error=0
fatal_has_php_diagnostic=1

Root cause

describeError() in the CLI returns error.message immediately for Error instances. In this failure path, the top-level Error has an empty message, but its cause contains the useful Blueprint/PHP failure details. Since the formatter does not inspect cause when message is empty, the CLI prints only Error:.

Related

This is adjacent to broader PHP fatal diagnostic issues such as #2278, but this issue is specifically about CLI formatting losing details that are already present in the error cause chain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions