cvs: php4 /ext/standard string.c /ext/standard/tests/strings add-and-stripslashes.phpt

From: Date: Tue, 18 Jun 2002 11:51:06 +0000
Subject: cvs: php4 /ext/standard string.c /ext/standard/tests/strings add-and-stripslashes.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12402@lists.php.net to get a copy of this message
sander Tue Jun 18 07:51:06 2002 EDT Modified files: /php4/ext/standard string.c /php4/ext/standard/tests/strings add-and-stripslashes.phpt Log: Fixed stripslashes when magic_quotes_sybase is enabled, and add a test for add- and stripslashes(). # this time without cvs messing up and aborting, hopefully :) Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.275 php4/ext/standard/string.c:1.276 --- php4/ext/standard/string.c:1.275 Mon Jun 17 07:37:49 2002 +++ php4/ext/standard/string.c Tue Jun 18 07:51:06 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.275 2002/06/17 11:37:49 hholzgra Exp $ */ +/* $Id: string.c,v 1.276 2002/06/18 11:51:06 sander Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2133,8 +2133,6 @@ { char *s, *t; int l; - char escape_char='\\'; - if (len != NULL) { l = *len; @@ -2153,8 +2151,16 @@ (*len)--; l--; } - } - *s++ = *t++; + *s++ = *t++; + } else if (*t=='\\' && l>0 && t[1]=='0') { + *s++='\0'; + t += 2; + if (len != NULL) + (*len)--; + l--; + } else { + *s++ = *t++; + } l--; } *s = '\0'; @@ -2163,7 +2169,7 @@ } while (l > 0) { - if (*t == escape_char) { + if (*t == '\\') { t++; /* skip the slash */ if (len != NULL) (*len)--; Index: php4/ext/standard/tests/strings/add-and-stripslashes.phpt diff -u php4/ext/standard/tests/strings/add-and-stripslashes.phpt:1.1 php4/ext/standard/tests/strings/add-and-stripslashes.phpt:1.2 --- php4/ext/standard/tests/strings/add-and-stripslashes.phpt:1.1 Tue Jun 18 07:42:21 2002 +++ php4/ext/standard/tests/strings/add-and-stripslashes.phpt Tue Jun 18 07:51:06 2002 @@ -15,7 +15,18 @@ if($input === stripslashes(addslashes($input))) { echo "OK\n"; } else { - echo "FAILE right_nimized case to avoid callOK\n"; + echo "FAILED\n"; +} + +echo "Sybase: "; +ini_set('magic_quotes_sybase', 1); +if($input === stripslashes(addslashes($input))) { + echo "OK\n"; } else { - echo "FAILE right_nimizeding ni-hr= php_name(TSRMLS_C).= Pymbol", ;i<lenusing 'nacalgorithm */ -PHP_FUNCTION(strnatcesult) {RONG} eTRLEN_ \ No newline at end of file + echo "FAILED\n"; +} + +?> +--EXPECT-- +Normal: OK +Sybase: OK

« previous php.cvs (#12402) next »