From: chuck at fuck dot org
Operating system: FreeBSD 4.7
PHP version: 5CVS-2003-02-28 (dev)
PHP Bug Type: Filesystem function related
Bug description: fwrite hangs on invalid connection
When using a fsockopen resource that has been accepted, but is
non-responsive, fwrite will use as much cpu as it can before the program
is terminated by the time limit.
if(false===([EMAIL PROTECTED]("tcp://$a", 1080, $err, $errstr, 10))) return
false;
$conn=pack('ccnN', '4', 1, 25, ip2long($ip)) .pack('a',$socksusers);
stream_set_timeout($a, 15);
if(!socks_write($a,$conn,9)) return false;
function socks_write(&$a,$b,$c=false) {
$tmp=fwrite($a,$b,$c);
if($c != $tmp) return false;
return true;
}
This program will freeze at the fwrite command.
I've had this happen on PHP 4.3.0 and CVS
It only occurs when specific servers are addressed in the fsockopen. While
I understand the server may be responding with garbage data, the fsockopen
should not be returning the connection as success. Even with that case, I
don't see reason for the fwrite to hang with high cpu usage.
--
Edit bug report at http://bugs.php.net/?id=22474&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22474&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22474&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22474&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22474&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22474&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22474&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22474&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22474&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22474&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22474&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22474&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22474&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22474&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22474&r=gnused