Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- GH-8409: Error in socket creation when error handler does not clean persistent co..
Decoded Output download
--TEST--
GH-8409: Error in socket creation when error handler does not clean persistent connection
--FILE--
<?php
set_error_handler(function (int $errno, string $errstring): never {
trigger_error($errstring, E_USER_ERROR);
});
register_shutdown_function(function (): void {
foreach (get_resources() as $res) {
if (get_resource_type($res) === 'persistent stream') {
echo "ERROR: persistent stream not closed
";
return;
}
}
echo "OK: persistent stream closed
";
});
stream_socket_client('tcp://9999.9999.9999.9999:9999', $error_code, $error_message, 0.2, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT);
echo "ERROR: this should not be visible
";
?>
--EXPECTF--
Fatal error: stream_socket_client(): %s in %sgh8409.php on line %d
OK: persistent stream closed
Did this file decode correctly?
Original Code
--TEST--
GH-8409: Error in socket creation when error handler does not clean persistent connection
--FILE--
<?php
set_error_handler(function (int $errno, string $errstring): never {
trigger_error($errstring, E_USER_ERROR);
});
register_shutdown_function(function (): void {
foreach (get_resources() as $res) {
if (get_resource_type($res) === 'persistent stream') {
echo "ERROR: persistent stream not closed\n";
return;
}
}
echo "OK: persistent stream closed\n";
});
stream_socket_client('tcp://9999.9999.9999.9999:9999', $error_code, $error_message, 0.2, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT);
echo "ERROR: this should not be visible\n";
?>
--EXPECTF--
Fatal error: stream_socket_client(): %s in %sgh8409.php on line %d
OK: persistent stream closed
Function Calls
None |
Stats
MD5 | 1f4cefdb1d5bcc8aa8886dac208a2bea |
Eval Count | 0 |
Decode Time | 64 ms |