summaryrefslogtreecommitdiff
path: root/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt')
-rw-r--r--ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
new file mode 100644
index 0000000..32756d7
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #60455: stream_get_line and \0 as a delimiter
+--FILE--
+<?php
+class TestStream {
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\0";
+
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
+
+}
+
+stream_wrapper_register("test", "TestStream");
+
+$f = fopen("test://", "r");
+var_dump(stream_get_line($f, 100, "\0"));
+--EXPECT--
+string(1) "a"