php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11271 low-level socket read() doesn't work properly
Submitted: 2001-06-04 19:02 UTC Modified: 2001-06-05 01:36 UTC
From: rumblepipe at altavista dot com Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.4 OS: Linux 2.2.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rumblepipe at altavista dot com
New email:
PHP Version: OS:

 

 [2001-06-04 19:02 UTC] rumblepipe at altavista dot com
configure --enable-sockets --with-apache=../apache --with-mysql

usage: typical C-style socket instantiation, write() the output, shutdown() on the write half (which tells the other end the transaction is done), read() (wait for the response), close.

The read absorbs junk before, throughout, and after the transaction return, and times out after 30 seconds, having read a WHOLE LOT of stuff it shouldn't.

This may have been fixed with 4.0.5, but I didn't get to test it thoroughly, because 4.0.5's mysql interface is broken.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-05 01:36 UTC] sniper@php.net
Without seeing the code I assume this is a quite common
problem, mostly because lack of documentation.

I have already added this to the CVS of the documentation
but as the main servers are still down the online manual
doesn't get updated. 

There is a 4th argument for read() which takes these 
three constants:

PHP_READ_SYSTEM - use the system read()
PHP_READ_BINARY - binary safe read() (same as PHP_READ_SYSTEM)
PHP_READ_NORMAL - Default. Reading stops at \n or \r.

So using the read like this:

read($fd, $buffer, $len, PHP_READ_SYSTEM)

should give you the same behaviour as C-style read() is.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 20:01:29 2024 UTC