Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Website] PHP Request errors don't show a error message #1993

Open
bgrgicak opened this issue Nov 12, 2024 · 3 comments
Open

[Website] PHP Request errors don't show a error message #1993

bgrgicak opened this issue Nov 12, 2024 · 3 comments

Comments

@bgrgicak
Copy link
Collaborator

When a PHP request throws a request error (e.g. PHP Fatal) the Website only prints the error to the browser console and the user sees a white screen (see screenshot).

We could help the user understand what happened if Playground showed an error message or opened the Logs modal instead of displaying a white screen.

PHP.wasm errors (internal to Playground) already do that by showing the Report error modal that contains logs.

Steps to recreate

Screenshots

PHP Request error example

@adamziel
Copy link
Collaborator

Good point, it would be useful to send the same output as server-side PHP would. Let's figure out if that's ever stderr or is it always stdout and make sure it's sent with the response. Or are we already doing that, but there's nothing in stdout because WP_DEBUG is false ?

@bgrgicak
Copy link
Collaborator Author

I did some quick testing and both hosted WP and Playground behave the same.
What I'm suggesting would be an improvement that Playground can offer because it controls the full stack.

Testing details

I used a hosted WP site and Playground, both had the same WP_DEBUG options.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

255 error

In the issue description, PHP returns a 255 error which is internal to PHP.
Both Playground and hosted WP return an empty screen in this case.

Note The Playground Website has a black background by default and this is why the hosted WP shows a white screen and Playground a black screen.

Blueprint example

Hosted WP
Image

Throw error

Here is an example of throwing a fatal error on the init hook, where both hosted WP and Playground behave the same.

Blueprint example

Hosted WP
Image

@bgrgicak
Copy link
Collaborator Author

But now when I think about it, a 255 error is internal to PHP and that means it's internal to Playground.
We should show the Error report modal for all 255 errors even if they are request errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Inbox
Development

No branches or pull requests

2 participants