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-- Bug #54623: Segfault when when writing to a persistent socket after closing a cop..

Decoded Output download

--TEST--
Bug #54623: Segfault when when writing to a persistent socket after closing a copy of the socket
--FILE--
<?php
$sock = pfsockopen('udp://127.0.0.1', '63844');
var_dump((int)$sock);
@fwrite($sock, "1");
$sock2 = pfsockopen('udp://127.0.0.1', '63844');
var_dump((int)$sock2);
@fwrite($sock2, "2");
fclose($sock2);
try {
    fwrite($sock, "3");
} catch (TypeError $e) {
    echo $e->getMessage(), "
";
}
?>
--EXPECTF--
int(%d)
int(%d)
fwrite(): supplied resource is not a valid stream resource

Did this file decode correctly?

Original Code

--TEST--
Bug #54623: Segfault when when writing to a persistent socket after closing a copy of the socket
--FILE--
<?php
$sock = pfsockopen('udp://127.0.0.1', '63844');
var_dump((int)$sock);
@fwrite($sock, "1");
$sock2 = pfsockopen('udp://127.0.0.1', '63844');
var_dump((int)$sock2);
@fwrite($sock2, "2");
fclose($sock2);
try {
    fwrite($sock, "3");
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
int(%d)
int(%d)
fwrite(): supplied resource is not a valid stream resource

Function Calls

pfsockopen 1

Variables

None

Stats

MD5 bdf206b64fdd4935ba328cd792216087
Eval Count 0
Decode Time 77 ms