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 if socket_set_option() works, option:TCP_DEFER_ACCEPT --EXTENSIONS-- sockets..

Decoded Output download

--TEST--
Test if socket_set_option() works, option:TCP_DEFER_ACCEPT
--EXTENSIONS--
sockets
--SKIPIF--
<?php

if (strpos(PHP_OS, 'Linux') === false) {
	die('SKIP on non Linux');
}
?>
--FILE--
<?php
echo "*** Test with TCP_DEFER_ACCEPT with initial SYN/ACK 'timeout' value to rounded up one ***
";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

if (!$socket) {
        die('Unable to create AF_INET socket [socket]');
}
$initial_val = 5;
var_dump(socket_set_option( $socket, SOL_TCP, TCP_DEFER_ACCEPT, $initial_val));
socket_listen($socket);
$rounded_up_val = socket_get_option( $socket, SOL_TCP, TCP_DEFER_ACCEPT);
socket_close($socket);
var_dump($rounded_up_val > $initial_val); // Value rounded up by the kernel, might differ from kernel version/setting
?>
--EXPECT--
*** Test with TCP_DEFER_ACCEPT with initial SYN/ACK 'timeout' value to rounded up one ***
bool(true)
bool(true)

Did this file decode correctly?

Original Code

--TEST--
Test if socket_set_option() works, option:TCP_DEFER_ACCEPT
--EXTENSIONS--
sockets
--SKIPIF--
<?php

if (strpos(PHP_OS, 'Linux') === false) {
	die('SKIP on non Linux');
}
?>
--FILE--
<?php
echo "*** Test with TCP_DEFER_ACCEPT with initial SYN/ACK 'timeout' value to rounded up one ***\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

if (!$socket) {
        die('Unable to create AF_INET socket [socket]');
}
$initial_val = 5;
var_dump(socket_set_option( $socket, SOL_TCP, TCP_DEFER_ACCEPT, $initial_val));
socket_listen($socket);
$rounded_up_val = socket_get_option( $socket, SOL_TCP, TCP_DEFER_ACCEPT);
socket_close($socket);
var_dump($rounded_up_val > $initial_val); // Value rounded up by the kernel, might differ from kernel version/setting
?>
--EXPECT--
*** Test with TCP_DEFER_ACCEPT with initial SYN/ACK 'timeout' value to rounded up one ***
bool(true)
bool(true)

Function Calls

None

Variables

None

Stats

MD5 69a81d0395389aa719e96cb443f81338
Eval Count 0
Decode Time 79 ms