Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Bug #14619 write() hangs
Submitted: 2008-09-08 19:31 UTC
From: codextasy Assigned: chagenbu
Status: Closed Package: Net_Socket (version 1.0.9)
PHP Version: 5.2.6 OS: Windows NT
Roadmaps: (Not assigned)    
Subscription  


 [2008-09-08 19:31 UTC] codextasy (Code Extasy)
Description: ------------ In case when connection is closed right before writing attempt, write() can hang up. The problem is that fwrite() returns 0 instead of false (as it is expected to do in case of an error) and "while ($pos < $size)..." becomes an endless loop. As far as writing of 0 bytes can only mean that it's impossibly to write anything, I propose to change error condition from $written === false to !$write.

Comments

 [2008-09-09 05:50 UTC] codextasy (Code Extasy)
Chuck, could you point the bug it duplicates, please? I've found no bug looking like this one in the package bug list.
 [2008-09-09 13:22 UTC] chagenbu (Chuck Hagenbuch)
14618. you created it twice.
 [2008-09-09 19:52 UTC] codextasy (Code Extasy)
Yes, I did. But there is a problem: I had submitted 14618 without registration/authorization. All my efforts to confirm my e-mail were unsuccessfull (there seems to be another bug of pear.php.net itself:). Then I registered first and submitted 14619. Could you mark 14618 as duplicate (instead of 14619) as it is no more accessible for users, please?
 [2008-10-13 11:29 UTC] doconnor (Daniel O'Connor)
Ok, let's make bug #14618 the dupe :)
 [2008-12-01 17:32 UTC] chagenbu (Chuck Hagenbuch)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I made a slight change to the patch; I have it return $written instead of false. That way if 0 bytes are written you get back 0, which as documented is still the number of bytes written.