]> granicus.if.org Git - php/commitdiff
fix for 22904
authorMoshe Doron <momo@php.net>
Mon, 31 Mar 2003 18:56:41 +0000 (18:56 +0000)
committerMoshe Doron <momo@php.net>
Mon, 31 Mar 2003 18:56:41 +0000 (18:56 +0000)
@ now addslashes() do it also on cybase magic mode(moshe).

ext/standard/string.c

index 1f367e08dc3d66234ef46ccbe47a686aee812862..132118661da47b516e48ff4d93b97da45645d280 100644 (file)
@@ -2331,13 +2331,18 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
                                        l--;
                                }
                                *s++ = *t++;
-                       } else if (*t == '\\' && l > 0 && t[1] == '0') {
+                       } else if (*t == '\\' && l > 0) {
+                               if(t[1] == '0') {
                                        *s++='\0';
-                                       t += 2;
-                                       if (len != NULL) {
-                                               (*len)--;
-                                       }
-                                       l--;
+                                       t++;
+                               } else {
+                                       *s++=*(++t);
+                               }
+                               t++;
+                               if (len != NULL) {
+                                       (*len)--;
+                               }
+                               l--;
                        } else {
                                *s++ = *t++;
                        }
@@ -2628,6 +2633,10 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
                                        *target++ = '\'';
                                        *target++ = '\'';
                                        break;
+                               case '\\':
+                                       *target++ = '\\';
+                                       *target++ = '\\';
+                                       break;
                                default:
                                        *target++ = *source;
                                        break;