Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.41
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
php-7.4.33 /
sapi /
fpm /
tests /
Delete
Unzip
Name
Size
Permission
Date
Action
CONFLICTS
102
B
-rw-rw-r--
2022-10-31 11:36
bug68381-log-level-warning.phpt
687
B
-rw-rw-r--
2022-10-31 11:36
bug68391-conf-include-order.phpt
1.02
KB
-rw-rw-r--
2022-10-31 11:36
bug68420-ipv4-all-addresses.phpt
642
B
-rw-rw-r--
2022-10-31 11:36
bug68421-ipv6-access-log.phpt
843
B
-rw-rw-r--
2022-10-31 11:36
bug68423-multi-pool-all-pms.phpt
1.08
KB
-rw-rw-r--
2022-10-31 11:36
bug68428-ipv6-allowed-clients.phpt
802
B
-rw-rw-r--
2022-10-31 11:36
bug68442-signal-reload.phpt
915
B
-rw-rw-r--
2022-10-31 11:36
bug68458-pm-no-start-server.phpt
665
B
-rw-rw-r--
2022-10-31 11:36
bug69625-no-script-filename.phpt
761
B
-rw-rw-r--
2022-10-31 11:36
bug72573-http-proxy.phpt
1.05
KB
-rw-rw-r--
2022-10-31 11:36
bug73342-nonblocking-stdio.phpt
795
B
-rw-rw-r--
2022-10-31 11:36
bug74083-concurrent-reload.phpt
1.73
KB
-rw-rw-r--
2022-10-31 11:36
bug75212-php-value-in-user-ini.phpt
977
B
-rw-rw-r--
2022-10-31 11:36
bug76601-reload-child-signals.phpt
2.63
KB
-rw-rw-r--
2022-10-31 11:36
bug77934-reload-process-control.phpt
959
B
-rw-rw-r--
2022-10-31 11:36
bug78323.phpt
683
B
-rw-rw-r--
2022-10-31 11:36
bug78599-path-info-underflow.phpt
1.04
KB
-rw-rw-r--
2022-10-31 11:36
bug80024-socket-reduced-inherit.phpt
897
B
-rw-rw-r--
2022-10-31 11:36
bug80849-fpm.phpt
706
B
-rw-rw-r--
2022-10-31 11:36
fastcgi_finish_request_basic.phpt
734
B
-rw-rw-r--
2022-10-31 11:36
fcgi.inc
19.84
KB
-rw-rw-r--
2022-10-31 11:36
fpm_get_status_basic.phpt
1.84
KB
-rw-rw-r--
2022-10-31 11:36
getallheaders.phpt
1.02
KB
-rw-rw-r--
2022-10-31 11:36
log-bm-in-shutdown-fn.phpt
886
B
-rw-rw-r--
2022-10-31 11:36
log-bm-limit-1024-msg-80.phpt
860
B
-rw-rw-r--
2022-10-31 11:36
log-bm-limit-2048-msg-4000.phpt
876
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-limit-1050-msg-2048.phpt
848
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-limit-1050-msg-2900.phpt
818
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-limit-64-too-low-error.phpt
736
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-limit-8000-msg-4096.phpt
818
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-msg-with-nl.phpt
869
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-multiple-msgs-stdout-stderr.phpt
1018
B
-rw-rw-r--
2022-10-31 11:36
log-bwd-multiple-msgs.phpt
972
B
-rw-rw-r--
2022-10-31 11:36
log-bwp-limit-1024-msg-120.phpt
846
B
-rw-rw-r--
2022-10-31 11:36
log-bwp-limit-1500-msg-3300.phpt
849
B
-rw-rw-r--
2022-10-31 11:36
log-bwp-msg-flush-split-fallback.phpt
959
B
-rw-rw-r--
2022-10-31 11:36
log-bwp-msg-flush-split-real.phpt
855
B
-rw-rw-r--
2022-10-31 11:36
log-bwp-realloc-buffer.phpt
1.07
KB
-rw-rw-r--
2022-10-31 11:36
log-dwd-limit-1050-msg-2048.phpt
845
B
-rw-rw-r--
2022-10-31 11:36
log-dwd-limit-1050-msg-2900.phpt
815
B
-rw-rw-r--
2022-10-31 11:36
log-dwd-limit-8000-msg-4096.phpt
815
B
-rw-rw-r--
2022-10-31 11:36
log-dwp-limit-1000-msg-2000.phpt
846
B
-rw-rw-r--
2022-10-31 11:36
logtool.inc
14.82
KB
-rw-rw-r--
2022-10-31 11:36
main-global-prefix.phpt
1.05
KB
-rw-rw-r--
2022-10-31 11:36
main-version.phpt
330
B
-rw-rw-r--
2022-10-31 11:36
pool-apparmor-basic.phpt
1.23
KB
-rw-rw-r--
2022-10-31 11:36
pool-prefix.phpt
1
KB
-rw-rw-r--
2022-10-31 11:36
proc-idle-timeout.phpt
877
B
-rw-rw-r--
2022-10-31 11:36
proc-no-start-server.phpt
742
B
-rw-rw-r--
2022-10-31 11:36
proc-user-ignored.phpt
795
B
-rw-rw-r--
2022-10-31 11:36
reload-uses-sigkill-as-last-measure.phpt
1.33
KB
-rw-rw-r--
2022-10-31 11:36
response.inc
6.62
KB
-rw-rw-r--
2022-10-31 11:36
skipif.inc
377
B
-rw-rw-r--
2022-10-31 11:36
socket-invalid-allowed-clients.phpt
1022
B
-rw-rw-r--
2022-10-31 11:36
socket-ipv4-allowed-clients.phpt
808
B
-rw-rw-r--
2022-10-31 11:36
socket-ipv4-basic.phpt
577
B
-rw-rw-r--
2022-10-31 11:36
socket-ipv4-fallback.phpt
910
B
-rw-rw-r--
2022-10-31 11:36
socket-ipv6-any.phpt
749
B
-rw-rw-r--
2022-10-31 11:36
socket-ipv6-basic.phpt
617
B
-rw-rw-r--
2022-10-31 11:36
socket-uds-acl.phpt
1.64
KB
-rw-rw-r--
2022-10-31 11:36
socket-uds-basic.phpt
649
B
-rw-rw-r--
2022-10-31 11:36
socket-uds-numeric-ugid-nonroot.phpt
1.26
KB
-rw-rw-r--
2022-10-31 11:36
socket-uds-numeric-ugid.phpt
1.13
KB
-rw-rw-r--
2022-10-31 11:36
status-basic.phpt
970
B
-rw-rw-r--
2022-10-31 11:36
status.inc
5.34
KB
-rw-rw-r--
2022-10-31 11:36
tester.inc
37.09
KB
-rw-rw-r--
2022-10-31 11:36
Save
Rename
<?php namespace FPM; class LogTool { const P_TIME = '\[\d\d-\w\w\w-\d{4} \d\d:\d\d:\d\d\]'; const P_PREFIX = '\[pool unconfined\] child \d+ said into stderr: '; const P_PREFIX_STDOUT = '\[pool unconfined\] child \d+ said into stdout: '; const FINAL_SUFFIX = ', pipe is closed'; const DEBUG = 'DEBUG'; const NOTICE = 'NOTICE'; const WARNING = 'WARNING'; const ERROR = 'ERROR'; const ALERT = 'ALERT'; /** * @var string */ private $message; /** * @var string */ private $level; /** * @var int */ private $position; /** * @var int */ private $suffixPosition; /** * @var int */ private $limit; /** * @var string */ private $pattern; /** * @var string */ private $error; /** * @var bool */ private $pipeClosed = false; /** * @param string $message * @param int $limit * @param int $repeat */ public function setExpectedMessage(string $message, int $limit, int $repeat = 0) { $this->message = ($repeat > 0) ? str_repeat($message, $repeat) : $message; $this->limit = $limit; $this->position = 0; } /** * @param string $level * @return int */ public function setExpectedLevel(string $level) { return $this->level = $level; } /** * @return string */ public function getExpectedLevel(): string { return $this->level ?: 'WARNING'; } /** * @param bool $pipeClosed */ public function setPipeClosed(bool $pipeClosed) { $this->pipeClosed = $pipeClosed; } /** * @param string $line * @return bool */ public function checkTruncatedMessage(string $line) { if ($this->message === null) { throw new \LogicException('The message has not been set'); } $lineLen = strlen($line); if (!$this->checkLineLength($line)) { return false; } $this->pattern = '/^PHP message: (.*?)(\.\.\.)?$/'; if (preg_match($this->pattern, $line, $matches) === 0) { return $this->error("Unexpected truncated message: {$line}"); } if ($lineLen === $this->limit - strlen('NOTICE: ') - 1) { if (!isset($matches[2])) { return $this->error("The truncated line is not ended with '...'"); } if (!$this->checkMessage($matches[1])) { return false; } } else { if (isset($matches[2])) { // this is expecting that the expected message does not end with '...' // which should not be an issue for the test purpose. return $this->error("The line is complete and should not end with '...'"); } if (!$this->checkMessage($matches[1], -1)) { return false; } } return true; } /** * @param array $lines * @param bool $terminated * @param bool $decorated * @return bool */ public function checkWrappedMessage(array $lines, bool $terminated = true, bool $decorated = true, bool $is_stderr = true) { if ($this->message === null) { throw new \LogicException('The message has not been set'); } if ($decorated) { $this->pattern = sprintf( '/^(%s %s: %s)"([^"]*)"(.*)?$/', self::P_TIME, $this->getExpectedLevel(), $is_stderr ? self::P_PREFIX : self::P_PREFIX_STDOUT ); } else { $this->pattern = null; } $idx = 0; foreach ($lines as $idx => $line) { if (!$this->checkLine($line)) { break; } } if ($this->suffixPosition > 0) { $suffixPattern = sprintf( '/^%s %s: %s(.*)$/', self::P_TIME, $this->getExpectedLevel(), $is_stderr ? self::P_PREFIX : self::P_PREFIX_STDOUT ); $line = $lines[++$idx]; if (preg_match($suffixPattern, $line, $matches) === 0) { return $this->error("Unexpected line: $line"); } if ($matches[1] !== substr(self::FINAL_SUFFIX, $this->suffixPosition)) { return $this->error( "The suffix has not been finished from position $this->suffixPosition in line: $line" ); } } if ($terminated) { return $this->expectTerminatorLines($lines, $idx); } return true; } /** * @param string $line * @return bool */ private function checkLine(string $line) { if ($this->pattern === null) { // plain (not decorated) output $out = rtrim($line); $finalSuffix = null; } elseif (($res = preg_match($this->pattern, $line, $matches)) > 0) { $out = $matches[2]; $finalSuffix = $matches[3] ?? false; } else { return $this->error("Unexpected line: $line"); } $rem = strlen($this->message) - $this->position; $lineLen = strlen($line); if (!$this->checkLineLength($line, $lineLen)) { return false; } if (!$this->checkMessage($out, $this->position)) { return false; } $outLen = strlen($out); if ($rem > $outLen) { // continuous line if ($lineLen !== $this->limit) { if ($lineLen + ($rem - $outLen) < $this->limit) { return $this->error("Printed less than the message len"); } return $this->error( "The continuous line length is $lineLen but it should equal to limit $this->limit" ); } $this->position += $outLen; return true; } if ($rem !== $outLen) { return $this->error("Printed more than the message len"); } if (!$this->pipeClosed || $finalSuffix === null) { return false; } if ($finalSuffix === false) { return $this->error("No final suffix"); } if (empty($finalSuffix) || strpos(self::FINAL_SUFFIX, $finalSuffix) === false) { return $this->error("The final suffix has to be equal to ', pipe is closed'"); } if (self::FINAL_SUFFIX !== $finalSuffix) { $this->suffixPosition = strlen($finalSuffix); } // complete final suffix printed return false; } /** * @param string $line * @param int $lineLen * @return bool */ private function checkLineLength(string $line, $lineLen = null) { $lineLen = $lineLen ?: strlen($line); if ($lineLen > $this->limit) { return $this->error( "The line length is $lineLen which is higher than limit $this->limit" ); } return true; } /** * @param string $matchedMessage * @param int $expectedMessageStart * @return bool */ private function checkMessage(string $matchedMessage, int $expectedMessageStart = 0) { if ($expectedMessageStart < 0) { $expectedMessage = $this->message; } else { $expectedMessage = substr($this->message, $expectedMessageStart, strlen($matchedMessage)); } if ($expectedMessage !== $matchedMessage) { return $this->error( sprintf( "The actual string(%d) does not match expected string(%d):\n", strlen($matchedMessage), strlen($expectedMessage) ) . "- EXPECT: '$expectedMessage'\n" . "- ACTUAL: '$matchedMessage'" ); } return true; } /** * @param array $lines * @return bool */ public function expectReloadingLines(array $lines) { if ( !$this->expectNotice($lines[0], 'Reloading in progress ...') || !$this->expectNotice($lines[1], 'reloading: .*') ) { return false; } for ($i = 2; $i < count($lines) - 2; $i++) { if (!$this->expectNotice($lines[$i], 'using inherited socket fd=\d+, "[^"]+"')) { return false; } } return $this->expectStartingLines(array_splice($lines, $i)); } /** * @param array $lines * @return bool */ public function expectStartingLines(array $lines) { if ($this->getError()) { return false; } if (count($lines) < 2) { return $this->error("No starting lines"); } return ( $this->expectNotice($lines[0], 'fpm is running, pid \d+') && $this->expectNotice($lines[1], 'ready to handle connections') ); } /** * @param array $lines * @param int $idx * @return bool */ public function expectTerminatorLines(array $lines, int $idx = -1) { if ($this->getError()) { return false; } if (count($lines) - $idx < 3) { return $this->error("No terminating lines"); } return ( $this->expectNotice($lines[++$idx], 'Terminating ...') && $this->expectNotice($lines[++$idx], 'exiting, bye-bye!') ); } /** * @param string $type * @param string $line * @param string $expectedMessage * @param string|null $pool * @return bool */ public function expectEntry(string $type, string $line, string $expectedMessage, $pool = null) { if ($this->getError()) { return false; } if ($pool !== null) { $expectedMessage = '\[pool ' . $pool . '\] ' . $expectedMessage; } $line = rtrim($line); $pattern = sprintf('/^%s %s: %s$/', self::P_TIME, $type, $expectedMessage); if (preg_match($pattern, $line, $matches) === 0) { return $this->error( "The $type does not match expected message:\n" . "- PATTERN: $pattern\n" . "- MESSAGE: $line\n" . "- EXPECT: '$expectedMessage'\n" . "- ACTUAL: '" . substr($line, strpos($line, $type) + strlen($type) + 2) . "'" ); } return true; } /** * @param string $line * @param string $expectedMessage * @param string|null $pool * @return bool */ public function expectDebug(string $line, string $expectedMessage, $pool = null) { return $this->expectEntry(self::DEBUG, $line, $expectedMessage, $pool); } /** * @param string $line * @param string $expectedMessage * @param string|null $pool * @return bool */ public function expectNotice(string $line, string $expectedMessage, $pool = null) { return $this->expectEntry(self::NOTICE, $line, $expectedMessage, $pool); } /** * @param string $line * @param string $expectedMessage * @param string|null $pool * @return bool */ public function expectWarning(string $line, string $expectedMessage, $pool = null) { return $this->expectEntry(self::WARNING, $line, $expectedMessage, $pool); } /** * @param string $line * @param string $expectedMessage * @param string|null $pool * @return bool */ public function expectError(string $line, string $expectedMessage, $pool = null) { return $this->expectEntry(self::ERROR, $line, $expectedMessage, $pool); } /** * @param string $line * @param string $expectedMessage * @param string|null $pool * @return bool */ public function expectAlert(string $line, string $expectedMessage, $pool = null) { return $this->expectEntry(self::ALERT, $line, $expectedMessage, $pool); } /** * @param string $msg * @return bool */ private function error(string $msg) { $this->error = $msg; echo "ERROR: $msg\n"; return false; } /** * @return string */ public function getError() { return $this->error; } } if (isset($argv[1]) && $argv[1] === 'logtool-selftest') { $cases = [ [ 'limit' => 1050, 'lines' => [ '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: "' . str_repeat('a', 968) . '"', '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: "' . str_repeat('a', 968) . '"', '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: "' . str_repeat('a', 112) . '", pipe is closed', '[08-Oct-2017 19:53:55] NOTICE: Terminating ...', '[08-Oct-2017 19:53:55] NOTICE: exiting, bye-bye!', ], 'message' => str_repeat('a', 2048), 'type' => 'stdio', ], [ 'limit' => 1050, 'lines' => [ '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: "' . str_repeat('a', 968) . '"', '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: "' . str_repeat('a', 968) . '"', '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: "' . str_repeat('a', 964) . '", pi', '[08-Oct-2017 19:53:50] WARNING: [pool unconfined] child 23183 said into stderr: pe is closed', '[08-Oct-2017 19:53:55] NOTICE: Terminating ...', '[08-Oct-2017 19:53:55] NOTICE: exiting, bye-bye!', ], 'message' => str_repeat('a', 2900), 'type' => 'stdio', ], [ 'limit' => 1024, 'line' => '[08-Oct-2017 19:53:50] WARNING: ' . str_repeat('a',989) . '...', 'message' => str_repeat('a', 2900), 'type' => 'message', ], [ 'limit' => 1024, 'line' => '[08-Oct-2017 19:53:50] WARNING: ' . str_repeat('a',20), 'message' => str_repeat('a', 20), 'type' => 'message', ], ]; foreach ($cases as $case) { printf("Test message with len %d and limit %d: ", strlen($case['message']), $case['limit']); $logTool = new LogTool(); $logTool->setExpectedMessage($case['message'], $case['limit']); if ($case['type'] === 'stdio') { $logTool->checkWrappedMessage($case['lines']); } else { $logTool->checkTruncatedMessage($case['line']); } if (!$logTool->getError()) { echo "OK\n"; } } echo "Done\n"; }