1--TEST-- 2Test if socket_set_option() works, option:SO_RCVTIMEO 3--DESCRIPTION-- 4-wrong params 5-set/get params comparison 6--SKIPIF-- 7<?php 8if (!extension_loaded('sockets')) { 9 die('SKIP sockets extension not available.'); 10} 11?> 12--FILE-- 13<?php 14$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 15if (!$socket) { 16 die('Unable to create AF_INET socket [socket]'); 17} 18socket_set_block($socket); 19 20//wrong params 21$retval_1 = socket_set_option( $socket, SOL_SOCKET, SO_RCVTIMEO, array()); 22 23//set/get comparison 24$options = array("sec" => 1, "usec" => 0); 25$retval_2 = socket_set_option( $socket, SOL_SOCKET, SO_RCVTIMEO, $options); 26$retval_3 = socket_get_option( $socket, SOL_SOCKET, SO_RCVTIMEO); 27 28var_dump($retval_2); 29var_dump($retval_3 === $options); 30socket_close($socket); 31?> 32 33--EXPECTF-- 34Warning: socket_set_option(): no key "sec" passed in optval in %s on line %d 35bool(true) 36bool(true) 37--CREDITS-- 38Moritz Neuhaeuser, info@xcompile.net 39PHP Testfest Berlin 2009-05-10 40