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-- Support for paths in the abstract namespace (bind, sendmsg, recvmsg) --EXTENSIONS..

Decoded Output download

--TEST--
Support for paths in the abstract namespace (bind, sendmsg, recvmsg)
--EXTENSIONS--
sockets
--SKIPIF--
<?php
if (PHP_OS != 'Linux') {
    die('skip For Linux only');
}
?>
--FILE--
<?php
include __DIR__."/mcast_helpers.php.inc";

$path = "/bar_foo";

echo "creating send socket
";
$sends1 = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_set_nonblock($sends1) or die("Could not put in non-blocking mode");

echo "creating receive socket
";
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_bind($s, $path) or die("err");

$r = socket_sendmsg($sends1, [
    "name" => [ "path" => $path],
    "iov" => ["test ", "thing", "
"],
], 0);
var_dump($r);
checktimeout($s, 500);

if (!socket_recv($s, $buf, 20, 0)) die("recv");
print_r($buf);
?>
--EXPECT--
creating send socket
creating receive socket
int(11)
test thing

Did this file decode correctly?

Original Code

--TEST--
Support for paths in the abstract namespace (bind, sendmsg, recvmsg)
--EXTENSIONS--
sockets
--SKIPIF--
<?php
if (PHP_OS != 'Linux') {
    die('skip For Linux only');
}
?>
--FILE--
<?php
include __DIR__."/mcast_helpers.php.inc";

$path = "\x00/bar_foo";

echo "creating send socket\n";
$sends1 = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_set_nonblock($sends1) or die("Could not put in non-blocking mode");

echo "creating receive socket\n";
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_bind($s, $path) or die("err");

$r = socket_sendmsg($sends1, [
    "name" => [ "path" => $path],
    "iov" => ["test ", "thing", "\n"],
], 0);
var_dump($r);
checktimeout($s, 500);

if (!socket_recv($s, $buf, 20, 0)) die("recv");
print_r($buf);
?>
--EXPECT--
creating send socket
creating receive socket
int(11)
test thing

Function Calls

None

Variables

None

Stats

MD5 053d3bfce5bf888a5b303867c3e58185
Eval Count 0
Decode Time 103 ms