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

Bug #1429 readFromSocket fails on \'0\'
Submitted: 2004-05-18 02:51 UTC Modified: 2004-07-02 12:24 UTC
From: rick at gibbed dot us Assigned: schst
Status: Closed Package: Net_Server
PHP Version: 4.3.6 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-18 02:51 UTC] rick at gibbed dot us
Description: ------------ If '0' (by itself?) is sent to the Net_Server server, the client will be dropped as if the client had sent an empty data package, this is due to an improper checking of the data that socket_read returns in Driver.php. It also fails in Driver/Sequential.php when checking for an empty data package. Fixes are provided. The fix for Driver/Fork.php is untested. Reproduce code: --------------- (affected line ~172 in Driver.php) while($buf = socket_read($this->clientFD[$clientId], $this->readBufferSize)) { (fixed version) while(($buf = socket_read($this->clientFD[$clientId], $this->readBufferSize, PHP_BINARY_READ)) !== false) { (affected line ~155 in Driver/Sequential.php) if (!$data) { (fixed version) if (trim($data) == "") { (affected line ~175) if (!$data) { (fixed version) if (trim($data) == "") { Expected result: ---------------- Not to close the connection on me ;-) Actual result: -------------- Closes connection. "Connection closed by peer."

Comments

 [2004-05-18 02:52 UTC] rick at gibbed dot us
(affected line ~175) should be (affected line ~175 in Driver/Fork.php)
 [2004-07-02 12:24 UTC] schst
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Net_Server