mirror of
https://github.com/php/php-src.git
synced 2025-08-17 06:28:50 +02:00
Merge branch 'PHP-8.0'
* PHP-8.0: Don't throw additional Error in require_once if exception already thrown
This commit is contained in:
commit
e396506cd6
2 changed files with 20 additions and 1 deletions
19
Zend/tests/require_once_warning_to_exception.phpt
Normal file
19
Zend/tests/require_once_warning_to_exception.phpt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
--TEST--
|
||||||
|
Promoting require_once warning to exception
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
|
||||||
|
throw new Exception($errstr);
|
||||||
|
}
|
||||||
|
set_error_handler("exception_error_handler");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$results = require_once 'does-not-exist.php';
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
};
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
require_once(does-not-exist.php): Failed to open stream: No such file or directory
|
|
@ -4240,7 +4240,7 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
|
||||||
already_compiled:
|
already_compiled:
|
||||||
new_op_array = ZEND_FAKE_OP_ARRAY;
|
new_op_array = ZEND_FAKE_OP_ARRAY;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!EG(exception)) {
|
||||||
zend_message_dispatcher(
|
zend_message_dispatcher(
|
||||||
(type == ZEND_INCLUDE_ONCE) ?
|
(type == ZEND_INCLUDE_ONCE) ?
|
||||||
ZMSG_FAILED_INCLUDE_FOPEN : ZMSG_FAILED_REQUIRE_FOPEN,
|
ZMSG_FAILED_INCLUDE_FOPEN : ZMSG_FAILED_REQUIRE_FOPEN,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue