php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9303 read() called with 'length' parameter reads until byte with ascii 10 or 13
Submitted: 2001-02-16 11:30 UTC Modified: 2001-06-02 21:26 UTC
From: yuri dot ismailov at era dot ericsson dot se Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.4pl1 OS: RedHat Linux
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 - 20 = ?
Subscribe to this entry?

 
 [2001-02-16 11:30 UTC] yuri dot ismailov at era dot ericsson dot se
read($sockfd, $in, $length); If I read an arbitrary byte stream from the socket and it happens to be ascii code (decimal) 10 or 13, the length parameter does not have any affect on the number of bytes read from the socket. It stops at the first occurence of the "magic" byte. To continue reading you have to call read again. It does not look like so in the manual for the read() function. However, bytes following ascii \0 and \t are succesfully read.
Is this is the feature or a bug?
PHP compiled --with-apxs --enable-sockets

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-02 21:26 UTC] sniper@php.net
Just use the 4th parameter (now documented, might not show
on the online manual yet) for read():

read($sockfd, $in, $length, PHP_READ_BINARY)


--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 18:01:28 2024 UTC