]> granicus.if.org Git - php/commitdiff
- Fixed bug #53248 (rawurlencode RFC 3986 EBCDIC support misses tilde char).
authorFelipe Pena <felipe@php.net>
Sun, 7 Nov 2010 12:59:22 +0000 (12:59 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 7 Nov 2010 12:59:22 +0000 (12:59 +0000)
  patch by: Justin Martin (frozenfire@php)

NEWS
ext/standard/tests/url/bug53248.phpt [new file with mode: 0644]
ext/standard/url.c

diff --git a/NEWS b/NEWS
index bdc615391e85511a850c146bda732cba72951e50..2fb199510142e7b65d8fd833d77798623229b74d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,8 @@
   obtained with ReflectionClass::getProperties(). (Gustavo)
 - Fixed covariance of return-by-ref constraints. (Etienne)
 
+- Fixed bug #53248 (rawurlencode RFC 3986 EBCDIC support misses tilde char).
+  (Justin Martin)
 - Fixed bug #53241 (stream casting that relies on fdopen/fopencookie fails
   with streams opened with, inter alia, the 'xb' mode). (Gustavo)
 - Fixed bug #53226 (file_exists fails on big filenames). (Adam)
diff --git a/ext/standard/tests/url/bug53248.phpt b/ext/standard/tests/url/bug53248.phpt
new file mode 100644 (file)
index 0000000..5e31c51
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+Bug #53248 (rawurlencode RFC 3986 EBCDIC support)
+--FILE--
+<?php
+
+var_dump(rawurlencode('A1_-.~'));
+var_dump(rawurldecode('%41%31%5F%2D%2E%7E'));
+
+?>
+--EXPECTF--
+string(6) "A1_-.~"
+string(6) "A1_-.~"
\ No newline at end of file
index b6e01d5513dcbaa9381f382f475b7273bf85c6b8..ae76e8c44a90e1a2d5803efd953ce645d5dd6603 100644 (file)
@@ -585,7 +585,7 @@ PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length)
                        str[y++] = hexchars[(unsigned char) s[x] >> 4];
                        str[y] = hexchars[(unsigned char) s[x] & 15];
 #else /*CHARSET_EBCDIC*/
-               if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) {
+               if (!isalnum(str[y]) && strchr("_-.~", str[y]) != NULL) {
                        str[y++] = '%';
                        str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
                        str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15];