felipe Thu Oct 30 10:08:01 2008 UTC
Added files:
/php-src/ext/standard/tests/streams bug46426.phpt
Modified files:
/php-src/ext/standard streamsfuncs.c
Log:
- Fixed bug #46426 (3rd parameter offset of stream_get_contents not works for
"0")
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.125&r2=1.126&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.125
php-src/ext/standard/streamsfuncs.c:1.126
--- php-src/ext/standard/streamsfuncs.c:1.125 Sun Oct 26 13:22:00 2008
+++ php-src/ext/standard/streamsfuncs.c Thu Oct 30 10:08:00 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.125 2008/10/26 13:22:00 felipe Exp $ */
+/* $Id: streamsfuncs.c,v 1.126 2008/10/30 10:08:00 felipe Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -408,7 +408,7 @@
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;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/bug46426.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/streams/bug46426.phpt
+++ php-src/ext/standard/tests/streams/bug46426.phpt
--TEST--
Bug #46426 (3rd parameter offset of stream_get_contents not works for "0")
--FILE--
<?php
$tmp = tmpfile();
fwrite($tmp, "12345");
echo stream_get_contents($tmp, -1, 0);
echo "\n";
echo stream_get_contents($tmp, -1, 1);
echo "\n";
echo stream_get_contents($tmp, -1, 2);
@unlink($tmp);
?>
--EXPECT--
12345
2345
345
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php