Date: 02/24/01
- Next message: jmoore <email protected>: "[PHP-DEV] PHP 4.0 Bug #9319 Updated: join function joins in reverse order in one specific instance."
- Previous message: jmoore <email protected>: "[PHP-DEV] PHP 4.0 Bug #3362 Updated: php_auth_user not passed back to apache"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: A.Ivanov <email protected>
Operating system: FreeBSD 4.2
PHP version: 4.0.4pl1
PHP Bug Type: Strings related
Bug description: Function stripslashes works not correct, as i think
magic_quotes_gpc = Off | On
<?
$text = "begin\\\\\\\\\\\\\end<br>"; // 13 backslashes
echo $text; // will print "begin\\\\\\\end" 7 backslashes
// Ok. We think that backslash is a special symbol
// to change the meaning of the next character,
// so in the reality we have 6 backslashes and one
// sequence "\a" but this mean nothing so we
// print "\a" like a plain text.
// It's alright. I have no question.
// then...
$text2 = stripslashes($text);
echo $text2;
// will print "begin\\\end" 3 backslashes
// WHY ????
// If the backslash is an ordinary symbol
// the function "stripslashes" should remove
// all of it.
// If the backslash is a special symbol, that
// understood by example showed above, then
// this function should remove 6 real slashes
// and echo will print "begin\end".
// So, if i need realy and correct remove all slashes
// from the string i should use following algorithm:
while(preg_match("/\\\/",$str))
$str = stripslashes($str);
// and i find it not so pretty............
?>
-- Edit Bug report at: http://bugs.php.net/?id=9437&edit=1-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: jmoore <email protected>: "[PHP-DEV] PHP 4.0 Bug #9319 Updated: join function joins in reverse order in one specific instance."
- Previous message: jmoore <email protected>: "[PHP-DEV] PHP 4.0 Bug #3362 Updated: php_auth_user not passed back to apache"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

