mirror of
https://github.com/php/php-src.git
synced 2024-12-11 10:54:47 +08:00
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 :)
This commit is contained in:
parent
07975157eb
commit
ace4a23dfc
@ -2133,8 +2133,6 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
|
||||
{
|
||||
char *s, *t;
|
||||
int l;
|
||||
char escape_char='\\';
|
||||
|
||||
|
||||
if (len != NULL) {
|
||||
l = *len;
|
||||
@ -2153,8 +2151,16 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
|
||||
(*len)--;
|
||||
l--;
|
||||
}
|
||||
*s++ = *t++;
|
||||
} else if (*t=='\\' && l>0 && t[1]=='0') {
|
||||
*s++='\0';
|
||||
t += 2;
|
||||
if (len != NULL)
|
||||
(*len)--;
|
||||
l--;
|
||||
} else {
|
||||
*s++ = *t++;
|
||||
}
|
||||
*s++ = *t++;
|
||||
l--;
|
||||
}
|
||||
*s = '\0';
|
||||
@ -2163,7 +2169,7 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
|
||||
}
|
||||
|
||||
while (l > 0) {
|
||||
if (*t == escape_char) {
|
||||
if (*t == '\\') {
|
||||
t++; /* skip the slash */
|
||||
if (len != NULL)
|
||||
(*len)--;
|
||||
|
@ -15,7 +15,18 @@ ini_set('magic_quotes_sybase', 0);
|
||||
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_
|
||||
echo "FAILED\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Normal: OK
|
||||
Sybase: OK
|
||||
|
Loading…
Reference in New Issue
Block a user