From: Felipe Pena <felipe@php.net>
Date: Sun, 7 Nov 2010 12:59:22 +0000 (+0000)
Subject: - Fixed bug #53248 (rawurlencode RFC 3986 EBCDIC support misses tilde char).
X-Git-Tag: php-5.4.0alpha1~191^2~722
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83ebbc36a13203254ff9c4b74f3eed3775b05a72;p=php

- Fixed bug #53248 (rawurlencode RFC 3986 EBCDIC support misses tilde char).
  patch by: Justin Martin (frozenfire@php)
---

diff --git a/ext/standard/tests/url/bug53248.phpt b/ext/standard/tests/url/bug53248.phpt
new file mode 100644
index 0000000000..5e31c510df
--- /dev/null
+++ b/ext/standard/tests/url/bug53248.phpt
@@ -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
diff --git a/ext/standard/url.c b/ext/standard/url.c
index dd99cb5301..ae9135075a 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -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];