diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/sockets/tests/socket_set_option_error_socket_option.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/sockets/tests/socket_set_option_error_socket_option.phpt')
-rw-r--r-- | ext/sockets/tests/socket_set_option_error_socket_option.phpt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/sockets/tests/socket_set_option_error_socket_option.phpt b/ext/sockets/tests/socket_set_option_error_socket_option.phpt new file mode 100644 index 0000000..eaa0e64 --- /dev/null +++ b/ext/sockets/tests/socket_set_option_error_socket_option.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test if socket_set_option() returns 'unable to set socket option' failure for invalid options +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('SKIP sockets extension not available.'); +} +$filename = dirname(__FILE__) . '/006_root_check.tmp'; +$fp = fopen($filename, 'w'); +fclose($fp); +if (fileowner($filename) == 0) { + unlink ($filename); + die('SKIP Test cannot be run as root.'); +} +?> +--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); +?> +--CLEAN-- +<?php +unlink(dirname(__FILE__) . '/006_root_check.tmp'); +--EXPECTF-- +Warning: socket_set_option(): unable to set socket option [%d]: Permission denied in %s on line %d +--CREDITS-- +Moritz Neuhaeuser, info@xcompile.net +PHP Testfest Berlin 2009-05-10 |