-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathgh15395-php-auth-shutdown.phpt
61 lines (56 loc) · 1.24 KB
/
gh15395-php-auth-shutdown.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--TEST--
FPM: GH-15335 - PHP_AUTH shutdown use after free
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php
require_once "tester.inc";
$cfg = <<<EOT
[global]
error_log = {{FILE:LOG}}
log_level = notice
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 1
catch_workers_output = yes
php_admin_value[cgi.fix_pathinfo] = no
EOT;
$code = <<<EOT
<?php
echo \$_SERVER["SCRIPT_NAME"] . "\n";
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
echo \$_SERVER["PHP_SELF"];
EOT;
$tester = new FPM\Tester($cfg, $code);
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
$tester->start();
$tester->expectLogStartNotices();
$tester
->request(
headers: [ "HTTP_AUTHORIZATION" => "Basic Zm9vOg==", "REQUEST_METHOD" => "GET"],
uri: $scriptName,
address: '{{ADDR}}',
scriptFilename: __DIR__ . "/__unknown.php",
scriptName: "/",
)
->expectStatus('404 Not Found');
$tester
->request(
uri: $scriptName,
address: '{{ADDR}}',
params: [],
);
$tester->expectNoLogPattern("/zend_mm_heap corrupted/");
$tester->terminate();
$tester->expectLogTerminatingNotices();
$tester->close();
?>
Done
--EXPECT--
Done
--CLEAN--
<?php
require_once "tester.inc";
FPM\Tester::clean();
?>