Re: ini_set() broken?
| From: | Tom Rogers | Date: | Mon, 08 Jul 2002 05:12:00 +0000 |
| Subject: | Re: ini_set() broken? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-106030@lists.php.net to get a copy of this message | ||
Hi
Even with the correct spelling it returns null (php-4.2.1)
$x = ini_get('register_globals');
echo "current settings = ".$x."<br>";
Tom
At 12:43 PM 8/07/2002 +0800, Jason Wong wrote:
Tom Rogers said: Hi If you check with phpinfo() you will see that it is getting set to 1 or 0 but by the time your script is run it is too late for it to have any effect. I just checked with an old PHP manual (probably 4.1.X) and register_globals can only be set in PHP_INI_PERDIR & PHP_INI_SYSTEM, ie cannot be set at run-time. So either they changed the behaviour in 4.2.X, or the latest manual is wrong. Also ini_get('registar_globals') will not return the current state. No, but ini_get('register_globals') will :) I have no idea why, it looks like one of those undocumented safety features... Tom However, in the one instance where I used it, it returned 'Off'. My guess is that it returns whatever was defined in php.ini. Thus if in php.ini you had defined register_globals = 1, then ini_get('register_globals') returns 1. It would be much better and less confusing if ini_get() returns values in a consistent notation, eg for booleans it should either return (0/1) OR (false/true). Another gotcha that I've come across is when setting register_globals (may or may not apply to other settings) in the apache conf file. This does NOT work: php_value register_globals On Whereas this does work: php_value register_globals 1 -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php