note 47073 added to function.addslashes

From: Date: Tue, 02 Nov 2004 04:44:55 +0000
Subject: note 47073 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-79478@lists.php.net to get a copy of this message
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! ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47073 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47073&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47073&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47073&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47073&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47073&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47073&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47073&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79478) next »