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
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: yuri dot ismailov at era dot ericsson dot se
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Thu Apr 09 04:01:23 2020 UTC