Yes, that was my previous code and you are right, its not right! I'll change it and thanks for letting me know.-----Original Message----- From: Chris Hewitt [mailto:[EMAIL PROTECTED] Sent: 03 April 2003 09:26 To: Justin French
[snip]
What I have done is to do the addslashes/stripslashes assuming magic_quotes_runtime is off then force it off within my code beforehand with:
if (ini_get('magic_quotes_runtime') == 1)
{
if (ini_set('magic_quotes_runtime','Off') == false)
{
echo "ERROR: Could not turn off magic_quotes_runtime\n";
}
}
I found that ini_set would through an error if the seting was already made, hence the initial check. So far this seems OK, but it was only yesterday...
Something bugged me about this code and comment when I very first read it, but it's taken an overnight cogitate to work out what it was. Dare I venture that your previous code, which sometimes appeared to throw an error, was simply:
if (ini_set('magic_quotes_runtime','Off') == false) { echo "ERROR: Could not turn off magic_quotes_runtime\n"; }
?
If so, there's a fundamental flaw here: as ini_set is defined to return the previous value of the setting, or FALSE if it fails, a simple equality comparison (==) to FALSE will succeed whenever the ini_set fails *or when the previous value was 0 (off)*. To echo your error only when ini_set() genuinely returns FALSE, you must do an identity comparison (===).
Regards
Chris
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php