|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2014-04-30 22:48 UTC] levim@php.net
-Status: Open
+Status: Feedback
-Package: Feature/Change Request
+Package: Streams related
-Operating System: Linux
+Operating System: Irrelevant
-PHP Version: 5.2.9
+PHP Version: Any
[2014-04-30 22:48 UTC] levim@php.net
[2014-05-05 02:03 UTC] ryan dot brothers at gmail dot com
[2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
[2015-01-03 13:05 UTC] ryan dot brothers at gmail dot com
[2015-01-03 13:27 UTC] nikic@php.net
-Status: No Feedback
+Status: Open
[2020-01-10 13:30 UTC] n at n0099 dot net
[2021-04-01 15:34 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-04-01 15:34 UTC] cmb@php.net
[2021-04-04 12:23 UTC] ryan dot brothers at gmail dot com
[2021-04-08 11:15 UTC] cmb@php.net
-Status: Feedback
+Status: Open
-Assigned To: cmb
+Assigned To:
[2021-04-08 11:15 UTC] cmb@php.net
[2022-05-06 10:39 UTC] crezasgov at aol dot com
[2022-05-06 10:40 UTC] crezasgov at aol dot com
[2022-05-06 10:41 UTC] maghsodid at yahoo dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 04:00:01 2025 UTC |
Description: ------------ I believe stream_get_line() should allow the $length parameter to be optional by allowing a $length of -1 that would read the remaining buffer up to either the $ending delimiter or EOF. Currently if you pass a $length of 0, the $length defaults to PHP_SOCK_CHUNK_SIZE (8192) in ext/standard/streamsfuncs.c. If you pass a length of -1, a PHP Warning is generated. Other 'similar' functions that allow length to be optional or -1 are fgets, stream_get_contents, and file_get_contents. Also, the manual page for stream_get_line() states that this function is the same fgets() except for the handling of the delimiter - but another difference, at least right now, is that the $length parameter is required in stream_get_line(), but optional in fgets(). Reproduce code: --------------- <?php $fp = tmpfile(); fwrite($fp, str_repeat('a', 10000)); fseek($fp, 0); echo strlen(stream_get_line($fp, 0)); fseek($fp, 0); echo strlen(stream_get_line($fp, -1)); fclose($fp); Expected result: ---------------- 8192 10000 Actual result: -------------- 8192 Warning: stream_get_line(): The maximum allowed length must be greater than or equal to zero