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

Bug #18262 Incomplete buffer sent with fwrite after bugfix #14619
Submitted: 2011-02-11 02:15 UTC
From: sberthelot Assigned: doconnor
Status: Closed Package: Net_Socket (version 1.0.10)
PHP Version: 5.2.11 OS: Linux 2.6.33.3
Roadmaps: (Not assigned)    
Subscription  


 [2011-02-11 02:15 UTC] sberthelot (Stephane Berthelot)
Description: ------------ The #14619 bug changed the way fwrite operates as a return value of 0 to a fwrite call would return immediately with the number of bytes written. But when testing I found out that writing to an SMTP socket to a "slow" server (using PEAR Mail) makes the socket "full" at 65536 bytes. Following attempts to fwrite return 0 until the socket has free "space" again and then following fwrites occur succesfuly until the last one. If I understand well the problem (socket closed before first fwrite) then the comparison fwrite result == 0 should be done only on first call. For my scenario I have 64x1024 bytes written, then 0 for some time then 512x1024 more and so on... Test script: --------------- Mail -> send() with an attachment > 65KB on my test machine. Expected result: ---------------- fwrite should complete until the last byte is sent or a real error condition occurs. It is not working and even unclear if a return of "0" means error or no byte could be sent (if this is the second then I'll file a bug request to PEAR Mail because it doesn't attempt to send again if fwrite result != buffer size) Actual result: -------------- Only first 65536 bytes are sent then fwrite returns

Comments

 [2011-02-11 02:16 UTC] sberthelot (Stephane Berthelot)
-Summary: Incomplete fwrites upon bugfix #14619 +Summary: Incomplete buffer sent with fwrite after bugfix #14619
 [2013-05-15 16:09 UTC] alec (Aleksander Machniak)
This is not so simple. Manual says "FALSE on error", but some comments in the manual point that it's not true and sometimes 0 is returned on error. Maybe it's not the case for recent PHP version, I don't know. http://php.net/manual/en/function.fwrite.php
 [2014-08-08 16:03 UTC] doconnor (Daniel O'Connor)
 [2014-08-08 16:03 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: doconnor
This bug has been fixed in SVN. 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.