Re: [PHP] ini_set('register_globals',0) doesn't work
Thank you for answer. I didn't expect ini_set('register_globals','Off') to work, that's why I had a look at the documentation. There should be PHP_INI_PERDIR, PHP_INI_SYSTEM but not PHP_INI_ALL in the table (so it's a mistake in the documentation). Anyway it may be possible to use this, if the variables are unset. This is overload of course, because the variables are first set (because of register_globals="On" in php.ini) and are unset if I call ini_set('register_globals','Off'), but this could be a nice "feature", making it easier to work with register_globals="Off" while other old projects still work. Do you consider this a good idea? Does anything except performance speak against doing this manually? Jens > register_globals affects things that happen before PHP parsing begins, so > by the time you get to your ini_set() it is too late. So no, that won't > work. You need to set it in your php.ini, httpd.conf or .htaccess. > > -Rasmus > > On Sun, 26 May 2002, Jens Lehmann wrote: > > > I tested ini_set('register_globals',0) and ini_set('register_globals','Off') > > for turning register_globals off. It doesn't work and it doesn't produce any > > notice, warning or error. > > > > Here's a quick example: > > > > > > > ini_set('register_globals',0); > > > > if(isset($test)) > > echo "$test"; > > > > ?> > > > > > > > > > > > > This prints out $test, what it shouldn't do with register_globals turned > > off. > > I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is > > supposed to work according to the documentation. Can anyone tell > > me what I've done wrong? > > > > For some strange reason if I do > > > > echo ini_set('register_globals',0); > > > > it will print "10". For > > > > echo ini_set('register_globals','Off'); > > > > it will print "1Off". > > > > Jens > > > > PS: ini_set works fine with include_path and error_reporting > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('register_globals',0) doesn't work
register_globals affects things that happen before PHP parsing begins, so by the time you get to your ini_set() it is too late. So no, that won't work. You need to set it in your php.ini, httpd.conf or .htaccess. -Rasmus On Sun, 26 May 2002, Jens Lehmann wrote: > I tested ini_set('register_globals',0) and ini_set('register_globals','Off') > for turning register_globals off. It doesn't work and it doesn't produce any > notice, warning or error. > > Here's a quick example: > > > ini_set('register_globals',0); > > if(isset($test)) > echo "$test"; > > ?> > > > > > > This prints out $test, what it shouldn't do with register_globals turned > off. > I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is > supposed to work according to the documentation. Can anyone tell > me what I've done wrong? > > For some strange reason if I do > > echo ini_set('register_globals',0); > > it will print "10". For > > echo ini_set('register_globals','Off'); > > it will print "1Off". > > Jens > > PS: ini_set works fine with include_path and error_reporting > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('register_globals',0) doesn't work
I tested ini_set('register_globals',0) and ini_set('register_globals','Off') for turning register_globals off. It doesn't work and it doesn't produce any notice, warning or error. Here's a quick example: $test"; ?> This prints out $test, what it shouldn't do with register_globals turned off. I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is supposed to work according to the documentation. Can anyone tell me what I've done wrong? For some strange reason if I do echo ini_set('register_globals',0); it will print "10". For echo ini_set('register_globals','Off'); it will print "1Off". Jens PS: ini_set works fine with include_path and error_reporting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php