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

Added the suppress error operator for @trigger_error() #973

Merged
merged 1 commit into from
Nov 26, 2019
Merged

Added the suppress error operator for @trigger_error() #973

merged 1 commit into from
Nov 26, 2019

Conversation

ezimuel
Copy link
Contributor

@ezimuel ezimuel commented Nov 26, 2019

This PR mitigate the usage of trigger_error() for E_USER_DEPRECATED using the @ suppress error operator.

The @ operator suppress the error message but it's still possible to catch it using a custom error handler, e.g. as follows:

set_error_handler(function ($errno, $errstr) {
    var_dump($errstr);
}, E_USER_DEPRECATED);

@trigger_error('Deprecation message here', E_USER_DEPRECATED);

Using this approach, we can give time to update the code related to the deprecation without breaking existing code (see https://github.com/babenkoivan/scout-elasticsearch-driver/issues/297 issue).

This is the same approach used by Symfony framework here.

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.

1 participant