1--TEST--
2Bug#54946 stream_get_contents infinite loop
3--FILE--
4<?php
5$filename = tempnam(__DIR__, "phpbug");
6$stream = fopen($filename, "w"); // w or a
7$retval = stream_get_contents($stream, 1, 1);
8fclose($stream);
9var_dump($retval);
10unlink($filename);
11
12
13
14$filename = tempnam(__DIR__, "phpbug2");
15
16$stream = fopen($filename, "a");
17$retval = stream_get_contents($stream, 1, 1);
18var_dump($retval);
19fclose($stream);
20unlink($filename);
21
22
23
24$filename = tempnam(__DIR__, "phpbug3");
25
26$stream = fopen($filename, "a");
27fseek($stream, 1);
28$retval = stream_get_contents($stream, 1);
29var_dump($retval);
30fclose($stream);
31unlink($filename);
32?>
33===DONE===
34--EXPECT--
35string(0) ""
36string(0) ""
37string(0) ""
38===DONE===
39