From: Derick Rethans Date: Thu, 28 Mar 2002 07:48:50 +0000 (+0000) Subject: - MFH for bug 16314 X-Git-Tag: php-4.2.0RC2~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=000eaf4a5aa8dee0051a93ad2f40a125695055b7;p=php - MFH for bug 16314 --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 110dcad657..f68158dd77 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2120,10 +2120,6 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) int l; char escape_char='\\'; - if (PG(magic_quotes_sybase)) { - escape_char='\''; - } - if (len != NULL) { l = *len; } else { @@ -2131,6 +2127,26 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) } s = str; t = str; + + if (PG(magic_quotes_sybase)) { + while (l >= 0) { + if(*t=='\'') { + if((l>0) && (t[1]=='\'')) { + t++; + if (len != NULL) + (*len)--; + l--; + } + } + *s++ = *t++; + l--; + } + *s = '\0'; + + return; + } + + while (l > 0) { if (*t == escape_char) { t++; /* skip the slash */