Re: PHP 4.0 Bug #9303: read() called with 'length' parameter reads until byte with ascii 10 or 13
| From: | chrisv at b0rked dot dhs dot org | Date: | Mon, 19 Feb 2001 09:47:37 +0000 |
| Subject: | Re: PHP 4.0 Bug #9303: read() called with 'length' parameter reads until byte with ascii 10 or 13 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-46876@lists.php.net to get a copy of this message | ||
It's supposed to be a feature. There is a 4th parameter (has been there
since 4.0.4 or so), which specifies the type of read to perform. If you
want to simply read ignoring any delimiters, specify PHP_BINARY_READ for
the parameter. Or you can use recv() which performs the same function
(mostly).
Chris
> From: yuri.ismailov@era.ericsson.se
> Operating system: RedHat Linux
> PHP version: 4.0.4pl1
> PHP Bug Type: Sockets related
> Bug description: read() called with 'length' parameter reads until byte with ascii
> 10 or 13
>
> 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