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() returns 'Unable to set socket option' failure for inv..
Decoded Output download
--TEST--
Test if socket_set_option() returns 'Unable to set socket option' failure for invalid options
--EXTENSIONS--
sockets
--SKIPIF--
<?php
if (PHP_OS == 'Darwin') {
die('skip Not for OSX');
}
$filename = __FILE__ . '.root_check.tmp';
$fp = fopen($filename, 'w');
fclose($fp);
if (fileowner($filename) == 0) {
unlink($filename);
die('SKIP Test cannot be run as root.');
}
unlink($filename);
?>
--FILE--
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!$socket) {
die('Unable to create AF_INET socket [socket]');
}
socket_set_option( $socket, SOL_SOCKET, 1, 1);
socket_close($socket);
?>
--EXPECTF--
Warning: socket_set_option(): Unable to set socket option [%d]: Permission denied in %s on line %d
--CREDITS--
Moritz Neuhaeuser, [email protected]
PHP Testfest Berlin 2009-05-10
Did this file decode correctly?
Original Code
--TEST--
Test if socket_set_option() returns 'Unable to set socket option' failure for invalid options
--EXTENSIONS--
sockets
--SKIPIF--
<?php
if (PHP_OS == 'Darwin') {
die('skip Not for OSX');
}
$filename = __FILE__ . '.root_check.tmp';
$fp = fopen($filename, 'w');
fclose($fp);
if (fileowner($filename) == 0) {
unlink($filename);
die('SKIP Test cannot be run as root.');
}
unlink($filename);
?>
--FILE--
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!$socket) {
die('Unable to create AF_INET socket [socket]');
}
socket_set_option( $socket, SOL_SOCKET, 1, 1);
socket_close($socket);
?>
--EXPECTF--
Warning: socket_set_option(): Unable to set socket option [%d]: Permission denied in %s on line %d
--CREDITS--
Moritz Neuhaeuser, [email protected]
PHP Testfest Berlin 2009-05-10
Function Calls
None |
Stats
MD5 | 43c37de63718e3e54ea267a7517f94d2 |
Eval Count | 0 |
Decode Time | 92 ms |