Skip to content

Fix EG(record_errors) leak when compilation bails out - #24149

Open
ptondereau wants to merge 1 commit into
php:PHP-8.5from
ptondereau:fix-record-errors-bailout
Open

ptondereau wants to merge 1 commit into
php:PHP-8.5from
ptondereau:fix-record-errors-bailout

Conversation

@ptondereau

@ptondereau ptondereau commented Oct 5, 2026 •

Copy link
Copy Markdown

Since 7b3e68f, a bailout in compile_file() or in the opcache optimizer leaves EG(record_errors) true. The next compilation fails the assertion Error recording already enabled, and PHP does not show later warnings.

This adds a zend_catch block to the three regions, as opcache_compile_file() does and the new zend_test.fatal_error_in_pass INI setting causes a fatal error in the optimizer for the tests.

@iliaal

iliaal commented Oct 6, 2026

Copy link
Copy Markdown
Member

This needs a NEWS entry, since warnings after a fatal compile error are silently dropped in 8.5.

Since 7b3e68f, a bailout in compile_file() or in the opcache optimizer
leaves EG(record_errors) true. The next compilation fails the assertion
"Error recording already enabled", and PHP does not show later warnings.

Add a zend_catch block to these three regions, as opcache_compile_file()
does. Add zend_test.fatal_error_in_pass to do a test of the optimizer.
@ptondereau
ptondereau force-pushed the fix-record-errors-bailout branch from d8e74ff to 82b29ed Compare October 6, 2026 12:46
@ptondereau

Copy link
Copy Markdown
Author

This needs a NEWS entry, since warnings after a fatal compile error are silently dropped in 8.5.

Thanks! Done, and sorry I wasn't very aware of the contribution guideline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants