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

Handling deprecation warnings #118

Closed
denis-sokolov opened this issue Dec 15, 2013 · 2 comments
Closed

Handling deprecation warnings #118

denis-sokolov opened this issue Dec 15, 2013 · 2 comments
Milestone

Comments

@denis-sokolov
Copy link
Collaborator

In the latest PrettyPageHandler a few methods are marked deprecated. In addition, they use trigger_error E_USER_DEPRECATED for warnings. Currently in Whoops fashion, such warnings are converted into ErrorExceptions and abort an application. Before the release of 1.1 we need to make these warnings backwards-compatible.

To begin with, we can just avoid using trigger_error E_USER_DEPRECATED. This would, however, take away the opportunity to detect the deprecation warnings when a developer wants such. It also then just becomes the same issue only with regard to 3rd party library code using same warnings. We probably want to handle that in a pretty fashion.

The second solution would be to just rely on people using Whoops to use error_reporting properly and hope that existing installations all have E_DEPRECATED and E_USER_DEPRECATED turned off in production. While the most semantic, this solution is in practice dangerous, as it is common practice to use E_ALL or E_ALL ^ E_STRICT. Also, see #117 for a user who was already unpleasantly suprised by the deprecation exception.

We could sidestep that by ignoring the value of deprecated error_reporting level in our handlers, and expose our own API to enable them back. In effect, deciding for everybody that they should have silenced deprecated warnings. However, this would mean that the default behavior of Whoops is to silence useful deprecation warnings unless the user has read our documentation well enough. It also might lead to un-intuitive problems where the users are really expecting Whoops to handle a warning and Whoops isn't.

The fourth solution could be to take ownership of the error_reporting. Make Whoops responsible for error reporting levels, like in the previous solution, only much more explicit. This would make Whoops more powerful, but as well put more responsibility on it. All users of Whoops would need to be educated about the new way to avoid using error_reporting directly.

The fifth solution would be to try to handle deprecation warnings in a completely different fashion, as was originally suggested in #100. Put them in the browser console, send by email, piggyback on real exceptions, all interesting solutions. This seems like a very nice and practical approach, but it also has downsides. One, it is hard to practically implement this, given how abstract the main Whoops behavior is, relying on many different handlers. For example, how do we implement any of these if the users have only activated the JsonHandler? Also, it seems unclear where to draw the line. If we consider deprecation warnings as minor, what about E_STRICT? E_NOTICE? (Not to mention that error levels in PHP are quite inconsistent)

@ghost ghost assigned denis-sokolov Dec 15, 2013
@denis-sokolov
Copy link
Collaborator Author

@filp, this is a big decision, perhaps you want to weight in or even make the call?

@denis-sokolov
Copy link
Collaborator Author

In the meantime I choose the first option, just not use the error type.
It is the safest option.

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

No branches or pull requests

1 participant