diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-08-10 12:54:02 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-08-10 12:54:02 +0200 |
commit | c439f1fa6a724bfd988d3832f6dc9faece4ea657 (patch) | |
tree | d5be0302da75a22791c5e2c59bf186f03324ff4d | |
parent | 7c3e487289ec41e560cf7a77e36eb43da2234f33 (diff) | |
download | php-git-c439f1fa6a724bfd988d3832f6dc9faece4ea657.tar.gz |
Fixed bug #62294
The primary issue was already resolved in 7c3e487289ec41e560cf7a77e36eb43da2234f33,
but the particular example used in this bug report ran into an
additional issue on PHP 8, because I forgot to drop a number of
zend_bailout calls when switch require failure to throw.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/zend_language_scanner.l | 1 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 4 | ||||
-rw-r--r-- | sapi/cli/tests/bug62294.inc | 5 | ||||
-rw-r--r-- | sapi/cli/tests/bug62294.phpt | 12 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_list.c | 1 |
6 files changed, 19 insertions, 6 deletions
@@ -19,6 +19,8 @@ PHP NEWS (Nikita) . Fixed bug #65275 (Calling exit() in a shutdown function does not change the exit value in CLI). (Nikita) + . Fixed bug #62294 (register_shutdown_function() does not correctly handle + exit code). (Nikita) - Date: . Fixed bug #60302 (DateTime::createFromFormat should new static(), not new diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index c5f897419d..c98c0f8e9b 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -655,7 +655,6 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type) if (!EG(exception)) { if (type==ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - zend_bailout(); } else { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 6f3ff1cead..a8187f0e90 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1716,7 +1716,6 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl if (!EG(exception)) { if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - zend_bailout(); } else { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } @@ -1875,7 +1874,6 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type) if (!EG(exception)) { if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - zend_bailout(); } else { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } @@ -2032,7 +2030,6 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) if (!EG(exception)) { if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - zend_bailout(); } else { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } @@ -2090,7 +2087,6 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) if (!EG(exception)) { if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - zend_bailout(); } else { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } diff --git a/sapi/cli/tests/bug62294.inc b/sapi/cli/tests/bug62294.inc new file mode 100644 index 0000000000..836fd44f28 --- /dev/null +++ b/sapi/cli/tests/bug62294.inc @@ -0,0 +1,5 @@ +<?php + +register_shutdown_function(function() { + require 'path/to/an/unknown/file'; +}); diff --git a/sapi/cli/tests/bug62294.phpt b/sapi/cli/tests/bug62294.phpt new file mode 100644 index 0000000000..b300729939 --- /dev/null +++ b/sapi/cli/tests/bug62294.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #62294: register_shutdown_function() does not handle exit code correctly +--FILE-- +<?php + +$php = getenv('TEST_PHP_EXECUTABLE'); +exec($php . ' ' . __DIR__ . '/bug62294.inc', $output, $exit_status); +var_dump($exit_status); + +?> +--EXPECT-- +int(255) diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index 5c1b950bf6..d9b2fa00d5 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -242,7 +242,6 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) { if (zend_stream_fixup(file, &bufptr, &len) == FAILURE) { if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file->filename); - zend_bailout(); } else { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file->filename); } |