mirror of
https://github.com/php/php-src.git
synced 2024-09-23 02:47:26 +00:00
Merge branch '5.3' into 5.4
This commit is contained in:
commit
f7d4076785
@ -0,0 +1,27 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #60455: stream_get_line and \0 as a delimiter
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class TestStream {
|
||||||
|
private $s = 0;
|
||||||
|
function stream_open($path, $mode, $options, &$opened_path) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function stream_read($count) {
|
||||||
|
if ($this->s++ == 0)
|
||||||
|
return "a\0";
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
function stream_eof() {
|
||||||
|
return $this->s >= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
stream_wrapper_register("test", "TestStream");
|
||||||
|
|
||||||
|
$f = fopen("test://", "r");
|
||||||
|
var_dump(stream_get_line($f, 100, "\0"));
|
||||||
|
--EXPECT--
|
||||||
|
string(1) "a"
|
@ -1028,8 +1028,8 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
|
|||||||
char *ret_buf, /* returned buffer */
|
char *ret_buf, /* returned buffer */
|
||||||
*found_delim = NULL;
|
*found_delim = NULL;
|
||||||
size_t buffered_len,
|
size_t buffered_len,
|
||||||
tent_ret_len; /* tentative returned length*/
|
tent_ret_len; /* tentative returned length */
|
||||||
int has_delim = delim_len > 0 && delim[0] != '\0';
|
int has_delim = delim_len > 0;
|
||||||
|
|
||||||
if (maxlen == 0) {
|
if (maxlen == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user