mirror of
https://github.com/php/php-src.git
synced 2025-01-23 20:23:31 +08:00
3943351e6a
fix the erratic behavior without breaking backwards compatibility. Namely, $offset retains SEEK_SET behavior but actually SEEK_CUR is passed to _php_stream_seek, if possible, by moving the offset stream->position bytes. - Addresses bug #53006.
35 lines
529 B
PHP
35 lines
529 B
PHP
--TEST--
|
|
Bug #46426 (3rd parameter offset of stream_get_contents not works for "0")
|
|
--FILE--
|
|
<?php
|
|
|
|
$tmp = tmpfile();
|
|
|
|
fwrite($tmp, b"12345");
|
|
|
|
echo stream_get_contents($tmp, 2, 1);
|
|
echo "\n";
|
|
echo stream_get_contents($tmp, -1);
|
|
echo "\n";
|
|
echo stream_get_contents($tmp, -1, 0);
|
|
echo "\n";
|
|
echo stream_get_contents($tmp, -1, 2);
|
|
echo "\n";
|
|
echo stream_get_contents($tmp, 0, 0);
|
|
echo "\n";
|
|
echo stream_get_contents($tmp, 1, 0);
|
|
echo "\n";
|
|
echo stream_get_contents($tmp, -1);
|
|
|
|
@unlink($tmp);
|
|
|
|
?>
|
|
--EXPECT--
|
|
23
|
|
45
|
|
12345
|
|
345
|
|
|
|
1
|
|
2345
|