Greg Donald said:
> On Sun, 7 Jul 2002, Miguel Cruz wrote:
>>> if(ini_set("register_globals", "0"))
>>> echo "ini_set success";
>>> echo "ini_set failed";
>>Please don't say "this code doesn't work." Say why you think it didn't
>> work, whether that's because you received an error message, or a
> Uhh.. I don't have any thoughts as to why it doesn't work, that's why I
Even if you don't know _why_ it didn't work, you could at least state what
you _expected_ to see and what you _actually_ saw.
> The function itself appears broken, my code is a test to that
> notion. If you can't be helpful then feel free to shutup..
It would be helpful on your part if you had stated your problem clearly.
>>expected outcome was not realized, or whatever. Otherwise it doesn't
>> really tell us anything. Obviously it doesn't work or you wouldn't be
>> posting it.
> Yes, the obvious is always pretty easy to restate. If you need more
> explanation than the code itself I don't knwo what to tell you.
Again, what you expected to happen, and what actually happened are usually
a good starting points.
>>> At http://php.net/ini_set it states the following setting is
>>> register_globals "0" PHP_INI_ALL
>>> Translated, PHP_INI_ALL means: Entry can be set anywhere
I'm not sure about this, but I don't think it was possible in previous
>>> So does anyone know why my code doesn't work then? ini_set() seems
>>> broken. Can anyone confirm or deny?
>>I believe the issue here is that by the time your PHP code starts
>> executing and gets to the ini_set call, it's too late to register the
> "gets to the ini_set call" - what do you mean? The code I posted is all
> there is to the entire script. Where else would I use the ini_set()
> function except at the very beginning of a script?
Because PHP registers the globals etc (if enabled) then starts working on
Anyway, regardless of whether or not it is possible to set
register_globals at run-time, your code would be better re-written as:
if (ini_set("register_globals", "0") !== FALSE)
echo "ini_set success";
echo "ini_set failed";
Because, if you RTFM, ini_set() will return the existing value of whatever
you're setting. Thus if register_globals was already disabled then your
original code would return "ini_set failed" everytime.
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