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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2022 The PHP Group
All rights reserved.
Last updated: Thu Jul 07 05:05:44 2022 UTC