summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-08-10 12:54:02 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-08-10 12:54:02 +0200
commitc439f1fa6a724bfd988d3832f6dc9faece4ea657 (patch)
treed5be0302da75a22791c5e2c59bf186f03324ff4d /sapi/cli
parent7c3e487289ec41e560cf7a77e36eb43da2234f33 (diff)
downloadphp-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.
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/tests/bug62294.inc5
-rw-r--r--sapi/cli/tests/bug62294.phpt12
2 files changed, 17 insertions, 0 deletions
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)