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-- Test socket_setopt() basic functionality --CREDITS-- Rodrigo Prado de Jesus <royo..

Decoded Output download

--TEST--
Test socket_setopt() basic functionality
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
User Group: PHPSP #PHPTestFestBrasil
--EXTENSIONS--
sockets
--FILE--
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!$socket) {
    die('Unable to create AF_INET socket [socket]');
}
socket_set_block($socket);

//set/get comparison
$options = array("sec" => 1, "usec" => 0);
$retval_1 = socket_setopt( $socket, SOL_SOCKET, SO_SNDTIMEO, $options);
$retval_2 = socket_getopt( $socket, SOL_SOCKET, SO_SNDTIMEO);

var_dump($retval_1);
var_dump($retval_2 === $options);
socket_close($socket);
?>
--EXPECT--
bool(true)
bool(true)

Did this file decode correctly?

Original Code

--TEST--
Test socket_setopt() basic functionality
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
User Group: PHPSP #PHPTestFestBrasil
--EXTENSIONS--
sockets
--FILE--
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!$socket) {
    die('Unable to create AF_INET socket [socket]');
}
socket_set_block($socket);

//set/get comparison
$options = array("sec" => 1, "usec" => 0);
$retval_1 = socket_setopt( $socket, SOL_SOCKET, SO_SNDTIMEO, $options);
$retval_2 = socket_getopt( $socket, SOL_SOCKET, SO_SNDTIMEO);

var_dump($retval_1);
var_dump($retval_2 === $options);
socket_close($socket);
?>
--EXPECT--
bool(true)
bool(true)

Function Calls

None

Variables

None

Stats

MD5 040fda4d719cdcf5a6df408201eac532
Eval Count 0
Decode Time 125 ms