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} 8$filename = dirname(__FILE__) . '/006_root_check.tmp'; 9$fp = fopen($filename, 'w'); 10fclose($fp); 11if (fileowner($filename) == 0) { 12 unlink ($filename); 13 die('SKIP Test cannot be run as root.'); 14} 15?> 16--FILE-- 17<?php 18$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 19if (!$socket) { 20 die('Unable to create AF_INET socket [socket]'); 21} 22 23socket_set_option( $socket, SOL_SOCKET, 1, 1); 24socket_close($socket); 25?> 26--CLEAN-- 27<?php 28unlink(dirname(__FILE__) . '/006_root_check.tmp'); 29--EXPECTF-- 30Warning: socket_set_option(): unable to set socket option [%d]: Permission denied in %s on line %d 31--CREDITS-- 32Moritz Neuhaeuser, info@xcompile.net 33PHP Testfest Berlin 2009-05-10 34