diff options
author | Jakub Zelenka <bukka@php.net> | 2020-02-09 19:40:25 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2020-02-23 18:29:10 +0000 |
commit | 0bc6a66a7a0624e63edcd2499f91b227cdb77f47 (patch) | |
tree | bc54b589e1eafbad832ac670ba0cba48feaea564 /sapi/fpm/tests | |
parent | 2a76e3a4571a7e31905a569580682e68cc003abb (diff) | |
download | php-git-0bc6a66a7a0624e63edcd2499f91b227cdb77f47.tar.gz |
Fix bug #77653 (operator displayed instead of the real error message)
Diffstat (limited to 'sapi/fpm/tests')
-rw-r--r-- | sapi/fpm/tests/log-bm-in-shutdown-fn.phpt | 49 | ||||
-rw-r--r-- | sapi/fpm/tests/log-bwp-msg-flush-split-fallback.phpt | 49 | ||||
-rw-r--r-- | sapi/fpm/tests/log-bwp-msg-flush-split-real.phpt | 46 |
3 files changed, 144 insertions, 0 deletions
diff --git a/sapi/fpm/tests/log-bm-in-shutdown-fn.phpt b/sapi/fpm/tests/log-bm-in-shutdown-fn.phpt new file mode 100644 index 0000000000..f968bf9f08 --- /dev/null +++ b/sapi/fpm/tests/log-bm-in-shutdown-fn.phpt @@ -0,0 +1,49 @@ +--TEST-- +FPM: Log message in shutdown function +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +require_once "tester.inc"; + +$cfg = <<<EOT +[global] +error_log = {{FILE:LOG}} +log_limit = 1024 +log_buffering = yes +[unconfined] +listen = {{ADDR}} +pm = dynamic +pm.max_children = 5 +pm.start_servers = 1 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +catch_workers_output = yes +EOT; + +$code = <<<EOT +<?php +register_shutdown_function(function() { + error_log(str_repeat('e', 80)); +}); +EOT; + +$tester = new FPM\Tester($cfg, $code); +$tester->start(); +$tester->expectLogStartNotices(); +$tester->request()->expectEmptyBody(); +$tester->terminate(); +$tester->expectFastCGIErrorMessage('e', 1050, 80); +$tester->expectLogMessage('NOTICE: PHP message: ' . str_repeat('e', 80), 1050); +$tester->close(); + +?> +Done +--EXPECT-- +Done +--CLEAN-- +<?php +require_once "tester.inc"; +FPM\Tester::clean(); +?> diff --git a/sapi/fpm/tests/log-bwp-msg-flush-split-fallback.phpt b/sapi/fpm/tests/log-bwp-msg-flush-split-fallback.phpt new file mode 100644 index 0000000000..0c152619a9 --- /dev/null +++ b/sapi/fpm/tests/log-bwp-msg-flush-split-fallback.phpt @@ -0,0 +1,49 @@ +--TEST-- +FPM: Buffered worker output plain log with msg with flush split in buffer +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +require_once "tester.inc"; + +$cfg = <<<EOT +[global] +error_log = {{FILE:LOG}} +[unconfined] +listen = {{ADDR}} +pm = dynamic +pm.max_children = 5 +pm.start_servers = 1 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +catch_workers_output = yes +decorate_workers_output = no +EOT; + +$code = <<<EOT +<?php +file_put_contents('php://stderr', str_repeat('a', 1021) . "\0fabc"); +EOT; + +$tester = new FPM\Tester($cfg, $code); +$tester->start(); +$tester->expectLogStartNotices(); +$tester->request()->expectEmptyBody(); +$tester->terminate(); +$lines = $tester->getLogLines(2); +var_dump($lines[0] === str_repeat('a', 1021) . "\0f\n"); +var_dump($lines[1] === "abc\n"); +$tester->close(); + +?> +Done +--EXPECT-- +bool(true) +bool(true) +Done +--CLEAN-- +<?php +require_once "tester.inc"; +FPM\Tester::clean(); +?> diff --git a/sapi/fpm/tests/log-bwp-msg-flush-split-real.phpt b/sapi/fpm/tests/log-bwp-msg-flush-split-real.phpt new file mode 100644 index 0000000000..63b2555de7 --- /dev/null +++ b/sapi/fpm/tests/log-bwp-msg-flush-split-real.phpt @@ -0,0 +1,46 @@ +--TEST-- +FPM: Buffered worker output plain log with msg with flush split in buffer +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +require_once "tester.inc"; + +$cfg = <<<EOT +[global] +error_log = {{FILE:LOG}} +[unconfined] +listen = {{ADDR}} +pm = dynamic +pm.max_children = 5 +pm.start_servers = 1 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +catch_workers_output = yes +decorate_workers_output = no +EOT; + +$code = <<<EOT +<?php +file_put_contents('php://stderr', str_repeat('a', 1022) . "\0fscf\0"); +EOT; + +$tester = new FPM\Tester($cfg, $code); +$tester->start(); +$tester->expectLogStartNotices(); +$tester->request()->expectEmptyBody(); +$tester->terminate(); +var_dump($tester->getLastLogLine() === str_repeat('a', 1022) . "\n"); +$tester->close(); + +?> +Done +--EXPECT-- +bool(true) +Done +--CLEAN-- +<?php +require_once "tester.inc"; +FPM\Tester::clean(); +?> |