summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Le Blanc <lbarnaud@php.net>2008-08-02 06:35:41 +0000
committerArnaud Le Blanc <lbarnaud@php.net>2008-08-02 06:35:41 +0000
commit5eb7ed731690cb5493ca5b31f5f134adeaa6b53d (patch)
tree5906d489081884c562e78b34a5583cf2ca3a167c
parente304515ddb434bb887c9d93cf0b4dd30a2ed94e4 (diff)
downloadphp-git-5eb7ed731690cb5493ca5b31f5f134adeaa6b53d.tar.gz
Allow urlencode()d filer names in php://filter
-rw-r--r--ext/standard/php_fopen_wrapper.c1
-rw-r--r--ext/standard/tests/file/bug43008.phpt15
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index b3772d5cac..7ed59cbe28 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -133,6 +133,7 @@ static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, i
p = php_strtok_r(filterlist, "|", &token);
while (p) {
+ php_url_decode(p, strlen(p));
if (read_chain) {
if ((temp_filter = php_stream_filter_create(p, NULL, php_stream_is_persistent(stream) TSRMLS_CC))) {
php_stream_filter_append(&stream->readfilters, temp_filter);
diff --git a/ext/standard/tests/file/bug43008.phpt b/ext/standard/tests/file/bug43008.phpt
new file mode 100644
index 0000000000..5e11cfcbe9
--- /dev/null
+++ b/ext/standard/tests/file/bug43008.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #43008 (php://filter uris ignore url encoded filternames and can't handle slashes)
+--FILE--
+<?php
+$url = b""
+ . b"php://filter/read="
+ . urlencode(b"convert.iconv.ISO-8859-15/UTF-8")
+ . b'|' . urlencode(b"string.rot13")
+ . b'|' . urlencode(b"string.rot13")
+ . b'|' . urlencode(b"convert.iconv.UTF-8/ISO-8859-15")
+ . b"/resource=data://text/plain,foob%E2r";
+var_dump(urlencode(file_get_contents($url)));
+?>
+--EXPECTF--
+string(8) "foob%E2r"