]> granicus.if.org Git - php/commitdiff
fix for Bug #16314
authorHartmut Holzgraefe <hholzgra@php.net>
Wed, 27 Mar 2002 20:20:57 +0000 (20:20 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Wed, 27 Mar 2002 20:20:57 +0000 (20:20 +0000)
ext/standard/string.c

index 019e29023aa81175a14378ce21bebd9fbd207808..fcec74a2cadfe97a4fbd6dd3a23d68df8df56b71 100644 (file)
@@ -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 */