Skip to content

Exclude E_USER_DEPRECATED from error handler mask - #337

Merged
ksucherek merged 1 commit into
masterfrom
bug/error-handler-exclude-user-deprecated
Jun 23, 2026
Merged

Exclude E_USER_DEPRECATED from error handler mask#337
ksucherek merged 1 commit into
masterfrom
bug/error-handler-exclude-user-deprecated

Conversation

@ksucherek

Copy link
Copy Markdown
Contributor

Problem

ErrorHandler::register() used the mask E_ALL & ~E_DEPRECATED, which only excludes E_DEPRECATED (8192 — PHP engine deprecations). E_USER_DEPRECATED (16384) is a separate bit emitted by userland code via trigger_error($msg, E_USER_DEPRECATED).

Because E_USER_DEPRECATED fell through the mask, handleError() received it and threw an ErrorException, turning a deprecation notice from third-party libraries (e.g. symfony/deprecation-contracts, used by microsoft/azure-storage-common) into a fatal HTTP 500 error.

Fix

Added & ~E_USER_DEPRECATED to the error handler mask in ErrorHandler::register().

// before
set_error_handler(..., E_ALL & ~E_DEPRECATED);

// after
set_error_handler(..., E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

E_DEPRECATED (8192) and E_USER_DEPRECATED (16384) are separate bits.
Without excluding E_USER_DEPRECATED, trigger_error() calls from
third-party libraries (e.g. symfony/deprecation-contracts) were caught
by handleError() and thrown as ErrorException, causing HTTP 500 errors.
@ksucherek ksucherek self-assigned this Jun 23, 2026
@ksucherek ksucherek added the bug label Jun 23, 2026
@ksucherek
ksucherek merged commit 17bb04d into master Jun 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants