]> granicus.if.org Git - php/commitdiff
- MFH for bug 16314
authorDerick Rethans <derick@php.net>
Thu, 28 Mar 2002 07:48:50 +0000 (07:48 +0000)
committerDerick Rethans <derick@php.net>
Thu, 28 Mar 2002 07:48:50 +0000 (07:48 +0000)
ext/standard/string.c

index 110dcad657772740b84608594073a5d5088ed009..f68158dd775ed6615b3483797ccc5c05e57fd49f 100644 (file)
@@ -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 */