Skip to content

Issue/598 Log deprecations in the error handler instead of throwing them - #602

Merged
armanist merged 1 commit into
quantum-php:masterfrom
armanist:issue/598-idiorm-null-deprecation
Oct 23, 2026
Merged

armanist merged 1 commit into
quantum-php:masterfrom
armanist:issue/598-idiorm-null-deprecation

Conversation

@armanist

Copy link
Copy Markdown
Collaborator

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_DEPRECATED or E_USER_DEPRECATED) with warning(), as <message> in <file>:<line>, and returns true so the script goes on. Without a logger yet it ignores the deprecation. Every other reported error still throws an ErrorException, and unreported errors still return false.

Why

handleError() threw an ErrorException for 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 NULL to PDO::quote(). Idiorm's query logging, which is on in debug mode, does that for every NULL bound value, so a debug-mode query with a NULL parameter failed with an ErrorException. Idiorm 1.5.8 is its last release, and it calls its logging as self::_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

  • A reported deprecation no longer stops the request or shows the error page. It is logged as a warning instead. Notices and warnings behave as before.

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 a NULL parameter inserts the row and logs the PDO::quote() warning. It fails with the ErrorException without the change.
  • The same query with real Idiorm and a plain PHP script worked without the handler and failed with it before the change; it works with it now.
  • Known gap: phpunit.xml still hides deprecations from the test suite (E_ALL & ~E_DEPRECATED). Showing them in CI is a separate decision.

Notes for reviewers

  • warning is the level PSR-3 gives for the use of deprecated APIs.
  • The handler's severity checks are unchanged for everything but the two deprecation severities.

…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.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3bf4619c-1417-4d43-a1b8-e9b0c7e92021
📥 Commits

Reviewing files that changed from the base of the PR and between 22f2d5b and 1dc2e2c.

📒 Files selected for processing: 3
  • src/Tracer/ErrorHandler.php
  • tests/Unit/Database/Adapters/Idiorm/IdiormDbalTest.php
  • tests/Unit/Tracer/ErrorHandlerTest.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@armanist
armanist merged commit c4150d1 into quantum-php:master Oct 23, 2026
7 checks passed
@armanist
armanist deleted the issue/598-idiorm-null-deprecation branch October 23, 2026 13:31
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.

Fix the PDO::quote() null deprecation in Idiorm query logging on PHP 8.1+

1 participant