summaryrefslogtreecommitdiff
path: root/sapi/cli/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-08-10 12:39:19 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-08-10 12:40:26 +0200
commit7c3e487289ec41e560cf7a77e36eb43da2234f33 (patch)
tree5b51aa6e654489014b3d62fb620ff4dd0fc2b9ca /sapi/cli/tests
parent4c1a490be53cfb4de16a0a20a89c3433fff72397 (diff)
downloadphp-git-7c3e487289ec41e560cf7a77e36eb43da2234f33.tar.gz
Fixed bug #65275
Make EG(exit_status) the single source of truth for the exit status, instead of having two variables that we cannot really keep synchronized.
Diffstat (limited to 'sapi/cli/tests')
-rw-r--r--sapi/cli/tests/bug65275.inc7
-rw-r--r--sapi/cli/tests/bug65275.phpt12
2 files changed, 19 insertions, 0 deletions
diff --git a/sapi/cli/tests/bug65275.inc b/sapi/cli/tests/bug65275.inc
new file mode 100644
index 0000000000..6b8a2ad948
--- /dev/null
+++ b/sapi/cli/tests/bug65275.inc
@@ -0,0 +1,7 @@
+<?php
+
+register_shutdown_function(function() {
+ die(111);
+});
+
+die(222);
diff --git a/sapi/cli/tests/bug65275.phpt b/sapi/cli/tests/bug65275.phpt
new file mode 100644
index 0000000000..1d59515996
--- /dev/null
+++ b/sapi/cli/tests/bug65275.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #65275: Calling exit() in a shutdown function does not change the exit value in CLI
+--FILE--
+<?php
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+exec($php . ' ' . __DIR__ . '/bug65275.inc', $output, $exit_status);
+var_dump($exit_status);
+
+?>
+--EXPECT--
+int(111)