#41512 [NEW]: ssl: socket_set_blocking not working

From: Date: Sun, 27 May 2007 12:55:50 +0000
Subject: #41512 [NEW]: ssl: socket_set_blocking not working
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113057@lists.php.net to get a copy of this message
From: darkbytes at linuxwaves dot com Operating system: Linux PHP version: 5.2.2 PHP Bug Type: Streams related Bug description: ssl: socket_set_blocking not working Description: ------------ socket_set_blocking() is not working on a ssl-connection. the reproduce code shows a connection without and with ssl, and loops for each to 10 when socket_set_blocking is working. plain sourcepacket from php.net, no patches: ./configure --enable-sockets --with-openssl Reproduce code: --------------- <?php echo "connecting without ssl\n"; $sock = fsockopen("euserv.de", 80,$errno, $errstr, 30); if($sock) echo "connected;\n"; socket_set_blocking($sock, 0); $count=0; while (!feof($sock)) { echo "loop: ".$count."\n"; fgets($sock, 4096); if($count==10) break; $count++; } fclose($sock); unset($sock); if($count==10) echo "stream_set_blocking(\$sock, 0); seems to work without ssl!\n"; else echo "it is not working :(\n"; echo "connecting with ssl\n"; $sock = fsockopen("ssl://euserv.de", 443,$errno, $errstr, 30); stream_set_blocking($sock, 0); $count=0; while (!feof($sock)) { echo "loop: ".$count."\n"; fgets($sock, 4096); if($count==10) break; $count++; } fclose($sock); unset($sock); if($count==10) echo "stream_set_blocking(\$sock, 0); seems to work with ssl!\n"; else echo "it is not working :(\n"; ?> Expected result: ---------------- it should loop from 0 to 10 two times - with and without ssl. Actual result: -------------- for me and a friend it outputs: [root@raw www]# php block.php connecting without ssl connected; loop: 0 loop: 1 ... loop: 10 stream_set_blocking($sock, 0); seems to work without ssl! connecting with ssl loop: 0 ---- here it hangs - socket seems to wait for input. -- Edit bug report at http://bugs.php.net/?id=41512&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41512&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41512&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41512&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41512&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41512&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41512&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41512&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41512&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41512&r=support Expected behavior: http://bugs.php.net/fix.php?id=41512&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41512&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41512&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41512&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41512&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41512&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41512&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41512&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41512&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41512&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41512&r=mysqlcfg

« previous php.bugs (#113057) next »