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--EXPECTF-- 33Warning: socket_set_option(): no key "sec" passed in optval in %s on line %d 34bool(true) 35bool(true) 36--CREDITS-- 37Moritz Neuhaeuser, info@xcompile.net 38PHP Testfest Berlin 2009-05-10 39