note 47073 deleted from function.addslashes by tularis
| From: | tularis@php.net | Date: | Tue, 02 Nov 2004 08:00:27 +0000 |
| Subject: | note 47073 deleted from function.addslashes by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79483@lists.php.net to get a copy of this message | ||
Note Submitter: emin at at yexmo dot com
----
addslashes is related with the magic_quotes_gpc and magic_quotes_sybase config values.
Working with different PHP configurations we will be find ourselves in the trouble. How can I sense
the magic_quotes_sybase value? And how can I change it in my script?
ini_set('magic_quotes_sybase',"1") or ini_get('magic_quotes_sybase')
don't work. ini_set has no effect. ini_get command returns nothing if ini_set didn't run
before.
if magic_quotes_sybase is on it overrides the magic_quotes_gpc and my script fails.
If magic_quotes_sybase is off my code is:
if (get_magic_quotes_gpc()) {
$mx = $m;
} else {
$mx = addslashes($m);
}
If magic_quotes_sybase is ON my code is:
if (get_magic_quotes_gpc()) {
$mx = $m;
$mx = str_replace("\\",chr(92).chr(92), $mx);
$mx = str_replace("''",chr(92)."'", $mx);
} else {
$mx = addslashes($m);
}
But I can not get the state of the magic_quotes_sybase or can not set it by
ini_set('magic_quotes_sybase', "0" )
Be carefully!
----
Reason: spam