Skip to content

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

Related to #157

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. 👍

@jrfnl jrfnl added this to the 2.2.0 milestone Sep 27, 2024
@jrfnl jrfnl requested a review from antecedent September 27, 2024 12:37
@antecedent antecedent merged commit 41249a2 into master Sep 27, 2024
@jrfnl jrfnl deleted the feature/php-8.4-replace-trigger-error-use branch September 27, 2024 17:04
@jrfnl jrfnl mentioned this pull request Dec 2, 2024
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.

4 participants