| Bug #1429 | readFromSocket fails on \'0\' |
| Submitted: |
2004年05月18日 07:51 UTC |
| From: |
rick at gibbed dot us |
Assigned: |
schst |
| Status: |
Closed |
Package: |
Net_Server |
| PHP Version: |
4.3.6 |
OS: |
Linux |
| Roadmaps: |
(Not assigned) |
[2004年05月18日 07: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日 07:52 UTC] rick at gibbed dot us
(affected line ~175) should be (affected line ~175 in Driver/Fork.php)
[2004年07月02日 17:24 UTC] User who submitted this comment has not confirmed identityIf you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE. Write a message to pear-dev@lists.php.net
to request the confirmation link. All bugs/comments/patches associated with this
email address will be deleted within 48 hours if the account request is not confirmed!