]> 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)

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

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 dd99cb530126e38b70dc07d329d1a801da0f8c50..ae9135075abb726e6d4a8fa2b5c526a6da8d1d50 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];