1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Files
archived-php-src/ext/standard/tests/streams/bug75031.phpt
T
Adam Saponara db96b7c245 Fix #75031: Support append mode in php://temp streams
This patch introduces a distinction between write mode and append
mode in `php://temp` and `php://memory` streams, achieving parity
with C stdio.
2017-08-04 12:43:49 +01:00

26 lines
527 B
PHP

--TEST--
Bug #75031: Append mode in php://temp and php://memory
--FILE--
<?php
function test_75031($type, $mode) {
$fp = fopen($type, $mode);
fwrite($fp, "hello");
fseek($fp, 0, SEEK_SET);
fwrite($fp, "world");
var_dump(stream_get_contents($fp, -1, 0));
fclose($fp);
}
test_75031("php://temp", "w+");
test_75031("php://memory", "w+");
test_75031("php://temp", "a+");
test_75031("php://memory", "a+");
?>
--EXPECT--
string(5) "world"
string(5) "world"
string(10) "helloworld"
string(10) "helloworld"