#28953 [NEW]: feof no longer detects SSL connections closed by the server

From: Date: Tue, 29 Jun 2004 03:41:06 +0000
Subject: #28953 [NEW]: feof no longer detects SSL connections closed by the server
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-61461@lists.php.net to get a copy of this message
From: mlemos at acm dot org Operating system: * PHP version: 4.3.7 PHP Bug Type: Sockets related Bug description: feof no longer detects SSL connections closed by the server Description: ------------ It seems that there were changes introduced after PHP 4.3.6, the feof function is no longer returning true when the server closes the SSL socket connection after transmiting all the contents. This seems to make it impossible to determine if there was a real network error or the server closed the connection normally breaking the compatibility of scripts that rely on feof to determine the end of connection condition. This seems to be a revival of bug 25939. It happens under PHp 4.3.2, 4.3.3, 4.3.4 and 4.3.7 . I does not happen under PHP 5.0.0RC3 . Although I could only reproduce it for SSL connections. It may be affecting normal TCP connections but I could not yet produce a test script to demonstrate it consistently. Reproduce code: --------------- <?php $socket=fsockopen("ssl://www.openssl.org", 443, $error); if(!$socket) { echo "socket opening error\n"; exit; } echo "connection opened\n"; if(!fputs($socket, "GET / HTTP/1.1\r\nHost: www.php.net\r\n\r\n")) { echo "socket writing error\n"; exit; } while(!feof($socket)) { $data=fread($socket, 1000); if(!$data) { echo "socket reading error\n"; exit; } echo "read ",strlen($data)," bytes\n"; } echo "reached the end of data\n"; fclose($socket); ?> Expected result: ---------------- connection opened read 574 bytes reached the end of data Actual result: -------------- connection opened read 574 bytes socket reading error -- Edit bug report at http://bugs.php.net/?id=28953&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28953&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28953&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28953&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28953&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28953&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28953&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28953&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28953&r=support Expected behavior: http://bugs.php.net/fix.php?id=28953&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28953&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28953&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28953&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28953&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28953&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28953&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28953&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28953&r=float

« previous php.bugs (#61461) next »