summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-05-02 16:57:24 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-05-03 12:19:37 +0200
commit69888c3ff1f2301ead8e37b23ff8481d475e29d2 (patch)
tree0f3a4d9963fc1aaf642d2524b73b57f332cc94b8 /ext/standard
parent34f727e63716dfb798865289c079b017812ad03b (diff)
downloadphp-git-69888c3ff1f2301ead8e37b23ff8481d475e29d2.tar.gz
Fix #79467: data:// wrappers are writable
Despite the docs claiming that data: wrappers would not be writable[1], they are implemented as writing to a memory stream. That does not seem to be particularly sensible, so we disallow writing altogether. [1] <https://www.php.net/manual/en/wrappers.data.php#refsect1-wrappers.data-options>
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/tests/streams/bug79467.phpt9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/standard/tests/streams/bug79467.phpt b/ext/standard/tests/streams/bug79467.phpt
new file mode 100644
index 0000000000..061160173d
--- /dev/null
+++ b/ext/standard/tests/streams/bug79467.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #79467 (data:// wrappers are writable)
+--FILE--
+<?php
+var_dump(file_put_contents('data://text/plain,cccc', 'data'));
+?>
+--EXPECTF--
+Notice: file_put_contents(): Stream is not writable in %s on line %d
+bool(false)