Repository navigation
Issue/598 Log deprecations in the error handler instead of throwing them - #602
Merged
armanist merged 1 commit intoOct 23, 2026
Merged
Conversation
…rowing them ErrorHandler::handleError() threw an ErrorException for every reported error, so a deprecation, which only warns about a future PHP version, stopped the request. Idiorm's query logging passes a NULL bound value to PDO::quote(), which PHP 8.1 deprecates, so a debug-mode query with a NULL parameter failed. A reported E_DEPRECATED or E_USER_DEPRECATED is now logged as a warning with its file and line, and the script goes on. Other errors still throw.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #598. Part of #595. The changelog entry and the Tracer docs are written in a final pull request, after the sub-issues.
What changed
ErrorHandler::handleError()logs a reported deprecation (E_DEPRECATEDorE_USER_DEPRECATED) withwarning(), as<message> in <file>:<line>, and returnstrueso the script goes on. Without a logger yet it ignores the deprecation. Every other reported error still throws anErrorException, and unreported errors still returnfalse.Why
handleError()threw anErrorExceptionfor every reported error, so in an application that reports deprecations (the PHP default in development) a deprecation stopped the request, though PHP itself carries on after one.PHP 8.1 deprecates passing
NULLtoPDO::quote(). Idiorm's query logging, which is on in debug mode, does that for everyNULLbound value, so a debug-mode query with aNULLparameter failed with anErrorException. Idiorm 1.5.8 is its last release, and it calls its logging asself::_log_query(), so a subclass cannot change it.Logging deprecations and continuing is what other frameworks do. In debug mode the web toolbar's messages tab shows them, the console writes them to the log file, and elsewhere the configured log level decides.
Breaking changes
Testing
ErrorHandlerTest: a deprecation is logged and not thrown, for both severities; without a logger nothing is thrown; an unreported deprecation is left to PHP.IdiormDbalTest: with the handler registered and all errors reported, a query with aNULLparameter inserts the row and logs thePDO::quote()warning. It fails with theErrorExceptionwithout the change.phpunit.xmlstill hides deprecations from the test suite (E_ALL & ~E_DEPRECATED). Showing them in CI is a separate decision.Notes for reviewers
warningis the level PSR-3 gives for the use of deprecated APIs.