From: Felipe Pena Date: Thu, 30 Oct 2008 10:08:01 +0000 (+0000) Subject: - Fixed bug #46426 (3rd parameter offset of stream_get_contents not works for "0") X-Git-Tag: BEFORE_HEAD_NS_CHANGE~131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d140cd1f0b8edaf0e9fe601946e500e0369e3869;p=php - Fixed bug #46426 (3rd parameter offset of stream_get_contents not works for "0") --- diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index f983a4df59..043fe9dc54 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -408,7 +408,7 @@ PHP_FUNCTION(stream_get_contents) php_stream_from_zval(stream, &zsrc); - if (pos > 0 && php_stream_seek(stream, pos, SEEK_SET) < 0) { + if (pos >= 0 && php_stream_seek(stream, pos, SEEK_SET) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos); RETURN_FALSE; } diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt new file mode 100644 index 0000000000..05bc9c1e3c --- /dev/null +++ b/ext/standard/tests/streams/bug46426.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #46426 (3rd parameter offset of stream_get_contents not works for "0") +--FILE-- + +--EXPECT-- +12345 +2345 +345