Fix error handling inconsistency with opcache

When opcache is enabled, error handling is altered in the following ways:

 * Errors emitted during compilation bypass the user-defined error handler
 * Exceptions emitted during class linking are turned into fatal errors

Changes here make the behavior consistent regardless of opcache being enabled or
not:

 * Errors emitted during compilation and class linking are always delayed and
   handled after compilation or class linking. During handling, user-defined
   error handlers are not bypassed. Fatal errors emitted during compilation or
   class linking cause any delayed errors to be handled immediately (without
   calling user-defined error handlers, as it would be unsafe).
 * Exceptions thrown by user-defined error handlers when handling class linking
   error are not promoted to fatal errors anymore and do not prevent linking.

Fixes GH-17422.
Closes GH-18541.
Closes GH-17627.

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
This commit is contained in:
Arnaud Le Blanc 2025-07-27 10:10:20 +02:00
parent 9b777b3c35
commit 7b3e68ff69
No known key found for this signature in database
36 changed files with 408 additions and 61 deletions

View file

@ -2054,6 +2054,7 @@ function generate_tmp_php_ini()
/* Fallback is implied, if filecache is enabled. */
INI.WriteLine("opcache.file_cache=" + dir);
INI.WriteLine("opcache.record_warnings=1");
INI.WriteLine("opcache.enable=1");
INI.WriteLine("opcache.enable_cli=1");
}