summaryrefslogtreecommitdiff
path: root/ext/standard/url.c
diff options
context:
space:
mode:
authorLars Strojny <lstrojny@php.net>2008-08-20 20:35:40 (GMT)
committerLars Strojny <lstrojny@php.net>2008-08-20 20:35:40 (GMT)
commit080157870f7791614b1d9c36851088aff82b2ca0 (patch)
treee699e395fcb5de197fe8a638cd198a54c4d624ce /ext/standard/url.c
parent6b2be7c7e96beb58de6d59e74055d2046b433815 (diff)
downloadphp-080157870f7791614b1d9c36851088aff82b2ca0.tar.gz
MFH: Allow mixed $initial (patch by Christian Seiler)
Diffstat (limited to 'ext/standard/url.c')
-rw-r--r--ext/standard/url.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 9dc8a2f..7d354d4 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -65,21 +65,23 @@ PHPAPI char *php_replace_controlchars_ex(char *str, int len)
{
unsigned char *s = (unsigned char *)str;
unsigned char *e = (unsigned char *)str + len;
-
+ unsigned char *r[len + 1];
+ unsigned int c = 0;
+
if (!str) {
- return (NULL);
+ return NULL;
}
-
+
while (s < e) {
-
- if (iscntrl(*s)) {
- *s='_';
- }
+ if (0 == iscntrl(*s)) {
+ r[c] = *s;
+ c++;
+ }
s++;
}
-
- return (str);
-}
+
+ return (unsigned char *)r;
+}
/* }}} */
PHPAPI char *php_replace_controlchars(char *str)