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

PHP 8.4 | Silence deprecation for trigger_error() #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Sep 18, 2024

PHP 8.4 deprecates passing E_USER_ERROR to trigger_error(), suggesting to use exceptions or exit instead.

This updates the exception handling in the test suite to avoid the deprecation and still continue to function as before, with the only difference being in the errors which are shown.

-Fatal error: No exception thrown in * on line *'
+'Fatal error: Uncaught ExceptionNotThrown: No exception thrown in *:*\n

-Fatal error: No exception of type RuntimeExsception thrown in * on line *'
+'Fatal error: Uncaught WrongExceptionThrown: No exception of type RuntimeExsception thrown in *:*\n

Ref: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error

PHP 8.4 deprecates passing `E_USER_ERROR` to `trigger_error()`, suggesting to use exceptions or `exit` instead.

This updates the exception handling in the test suite to avoid the deprecation and still continue to function as before, with the only difference being in the errors which are shown.

```diff
-Fatal error: No exception thrown in * on line *'
+'Fatal error: Uncaught ExceptionNotThrown: No exception thrown in *:*\n

-Fatal error: No exception of type RuntimeExsception thrown in * on line *'
+'Fatal error: Uncaught WrongExceptionThrown: No exception of type RuntimeExsception thrown in *:*\n
```

Ref: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
Copy link
Collaborator

@anomiex anomiex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the proper hoops to jump through for that PHP deprecation. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants