mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fix GH-9981: FPM does not reset fastcgi.error_header
This commit is contained in:
parent
29926c3262
commit
a3891d9d1a
4
NEWS
4
NEWS
@ -13,6 +13,10 @@ PHP NEWS
|
||||
. Fixed bug GH-9891 (DateTime modify with unixtimestamp (@) must work like
|
||||
setTimestamp). (Derick)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug GH-9981 (FPM does not reset fastcgi.error_header).
|
||||
(Jakub Zelenka)
|
||||
|
||||
- LDAP:
|
||||
. Fixed bug GH-10112 (LDAP\Connection::__construct() refers to ldap_create()).
|
||||
(cmb)
|
||||
|
@ -1911,6 +1911,9 @@ consult the installation file that came with this distribution, or visit \n\
|
||||
|
||||
fpm_request_executing();
|
||||
|
||||
/* Reset exit status from the previous execution */
|
||||
EG(exit_status) = 0;
|
||||
|
||||
php_execute_script(&file_handle);
|
||||
|
||||
fastcgi_request_done:
|
||||
|
51
sapi/fpm/tests/gh9981-fastcgi-error-header-reset.phpt
Normal file
51
sapi/fpm/tests/gh9981-fastcgi-error-header-reset.phpt
Normal file
@ -0,0 +1,51 @@
|
||||
--TEST--
|
||||
FPM: gh9981 - fastcgi.error_header is not reset
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = static
|
||||
pm.max_children = 1
|
||||
catch_workers_output = yes
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
if (isset(\$_GET['q'])) {
|
||||
echo 'ok';
|
||||
} else {
|
||||
d();
|
||||
}
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
$tester->start(iniEntries: [
|
||||
'fastcgi.error_header' => '"HTTP/1.1 500 PHP Error"',
|
||||
'output_buffering' => 4096,
|
||||
]);
|
||||
$tester->expectLogStartNotices();
|
||||
$tester->request()->expectStatus('500 PHP Error');
|
||||
$tester->request('q=1')->expectNoStatus();
|
||||
$tester->terminate();
|
||||
$tester->expectLogTerminatingNotices();
|
||||
$tester->expectNoLogPattern('/Cannot modify header information/');
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
@ -134,6 +134,36 @@ class Response
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expect response status.
|
||||
*
|
||||
* @param string|null $status Expected status.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function expectStatus(string|null $status): Response {
|
||||
$headers = $this->getHeaders();
|
||||
if (is_null($status) && !isset($headers['status'])) {
|
||||
return $this;
|
||||
}
|
||||
if (!is_null($status) && !isset($headers['status'])) {
|
||||
$this->error('Status is expected but not supplied');
|
||||
} elseif ($status !== $headers['status']) {
|
||||
$statusMessage = $status === null ? "expected not to be set": "expected to be $status";
|
||||
$this->error("Status is $statusMessage but the actual value is {$headers['status']}");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expect response status not to be set.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function expectNoStatus(): Response {
|
||||
return $this->expectStatus(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expect no error in the response.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user