1--TEST-- 2Test if socket_set_option() returns 'Unable to set socket option' failure for invalid options 3--SKIPIF-- 4<?php 5if (!extension_loaded('sockets')) { 6 die('SKIP sockets extension not available.'); 7} 8if (PHP_OS == 'Darwin') { 9 die('skip Not for OSX'); 10} 11$filename = __FILE__ . '.root_check.tmp'; 12$fp = fopen($filename, 'w'); 13fclose($fp); 14if (fileowner($filename) == 0) { 15 unlink($filename); 16 die('SKIP Test cannot be run as root.'); 17} 18unlink($filename); 19?> 20--FILE-- 21<?php 22$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 23if (!$socket) { 24 die('Unable to create AF_INET socket [socket]'); 25} 26 27socket_set_option( $socket, SOL_SOCKET, 1, 1); 28socket_close($socket); 29?> 30--EXPECTF-- 31Warning: socket_set_option(): Unable to set socket option [%d]: Permission denied in %s on line %d 32--CREDITS-- 33Moritz Neuhaeuser, info@xcompile.net 34PHP Testfest Berlin 2009-05-10 35