php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33163 stream_get_line() has ambiguous semantics
Submitted: 2005-05-27 15:34 UTC Modified: 2005-06-04 01:00 UTC
From: isak at hypergene dot com Assigned:
Status: No Feedback Package: Feature/Change Request
PHP Version: 5.0.4 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-05-27 15:34 UTC] isak at hypergene dot com
Description:
------------
It is impossible to use this function to read exactly one line of arbitrary length, even if you call it multiple times and concatenates the results to a buffer.

When the return value is equal to the length argument, you can't know what this means. It can be either one of these cases:

1. You have read one full line, which is exactly as long as the given length.
2. You have read part of one line, which is longer than the given length.

In case 1. you will go on and use the line, in case 2. you would want to make another call and concatenate its result to your line buffer.

IMHO, the length argument really should be optional. It is obviously possible to include the function stream_get_contents() in the PHP library, therefore I can see no reason why the library should not be able to read strings of arbitrary length.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-27 17:01 UTC] wez@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
 [2005-06-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 17:01:29 2024 UTC