Skip to content

Prevent fatal errors not reported#6296

Closed
staabm wants to merge 6 commits intosebastianbergmann:mainfrom
staabm:bug6294
Closed

Prevent fatal errors not reported#6296
staabm wants to merge 6 commits intosebastianbergmann:mainfrom
staabm:bug6294

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Aug 8, 2025

happens when php.ini declares display_errors=0

closes #6294

@sebastianbergmann
Copy link
Copy Markdown
Owner

I am not convinced (yet) that using ini_set() to "fix" the configuration is the right course of action here.

In the meantime, I have updated the documentation to also suggest display_errors=On: sebastianbergmann/phpunit-documentation-english@b3b159c

@staabm staabm marked this pull request as ready for review August 8, 2025 08:21
@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Aug 8, 2025

alternative fix could be to suggest

<php>
  <ini name="display_errors" value="On"/>
</php>

in the configuration file when auto-generating.

but my gut feeling is, that people might miss a lot of obvious errors when not using the correct ini setting (which would mean lots of support tickets on phpunit).


we could also try to render a phpunit warning when display_errors=0, but atm phpunit crashes at the fatal error (so we would need a prepared error message in a shutdown function or similar)

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Aug 8, 2025

pushed an alternative and less invasive fix, which does not change the config with ini_set(), but instead prepares a error message which gets printed on premature fatal errors

@sebastianbergmann
Copy link
Copy Markdown
Owner

This should target the 12.3 branch, right?

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Aug 8, 2025

yes

@sebastianbergmann
Copy link
Copy Markdown
Owner

Cherry-picked into 12.3 and merged to main from there.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent failure of PHP fatal errors

2 participants