From 492c8372728ff682cdf23d47f4a76dde92b02b7c Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Wed, 27 Mar 2002 20:20:57 +0000 Subject: [PATCH] fix for Bug #16314 --- ext/standard/string.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 019e29023a..fcec74a2ca 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2120,9 +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; @@ -2131,6 +2128,25 @@ 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 */ -- 2.40.0