lbarnaud Sat Aug 2 06:37:35 2008 UTC
Modified files:
/php-src/ext/standard php_fopen_wrapper.c
/php-src/ext/standard/tests/file bug43008.phpt
Log:
MFB: Allow urlencode()d filer names in php://filter (fixes #43008)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/php_fopen_wrapper.c?r1=1.62&r2=1.63&diff_format=u
Index: php-src/ext/standard/php_fopen_wrapper.c
diff -u php-src/ext/standard/php_fopen_wrapper.c:1.62
php-src/ext/standard/php_fopen_wrapper.c:1.63
--- php-src/ext/standard/php_fopen_wrapper.c:1.62 Mon Dec 31 07:12:16 2007
+++ php-src/ext/standard/php_fopen_wrapper.c Sat Aug 2 06:37:34 2008
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_fopen_wrapper.c,v 1.62 2007/12/31 07:12:16 sebastian Exp $ */
+/* $Id: php_fopen_wrapper.c,v 1.63 2008/08/02 06:37:34 lbarnaud Exp $ */
#include <stdio.h>
#include <stdlib.h>
@@ -142,6 +142,7 @@
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);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug43008.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/file/bug43008.phpt
diff -u /dev/null php-src/ext/standard/tests/file/bug43008.phpt:1.2
--- /dev/null Sat Aug 2 06:37:35 2008
+++ php-src/ext/standard/tests/file/bug43008.phpt Sat Aug 2 06:37:34 2008
@@ -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"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php