Re: [PHP] ini_set() broken?
You cannot set register_globals at runtime via ini_set(). The documentation goes off the PHP4 source which is, to put it simply, a little wrong. The PHP4 source says register_globals is PHP_INI_ALL when in the real world it isn't. .htaccess is as close as you'll get. The ini_set() docs are autogenerated and this issue is being looked into. The correct docs on this are now in phpdoc CVS and will show up soon. In short, don't attempt to set register_globals at runtime as explained by a few in this thread, it won't fully work as expected. Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Well, you can set it at runtime, it just won't do what you might expect. That doesn't mean that it may not be useful to be able to set it at runtime. If, for example, you have register_globals off and you write an auto-prepend script, or even just a normal snippet of code that you insert into some other app at the beginning that emulates register_globals, then you may want to set register_globals = on at runtime so that any subsequent checks by the app will behave correctly. -Rasmus On Mon, 8 Jul 2002, Philip Olson wrote: You cannot set register_globals at runtime via ini_set(). The documentation goes off the PHP4 source which is, to put it simply, a little wrong. The PHP4 source says register_globals is PHP_INI_ALL when in the real world it isn't. .htaccess is as close as you'll get. The ini_set() docs are autogenerated and this issue is being looked into. The correct docs on this are now in phpdoc CVS and will show up soon. In short, don't attempt to set register_globals at runtime as explained by a few in this thread, it won't fully work as expected. Regards, Philip Olson -- 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() broken?
Hello Rasmus- How do you suggest ini_set() document these differences? Maybe the table at ini_set() could use another column, for descriptions and notes. Also, could you give a concise description for the differences between local and master values? Regards, Philip Olson On Mon, 8 Jul 2002, Rasmus Lerdorf wrote: Well, you can set it at runtime, it just won't do what you might expect. That doesn't mean that it may not be useful to be able to set it at runtime. If, for example, you have register_globals off and you write an auto-prepend script, or even just a normal snippet of code that you insert into some other app at the beginning that emulates register_globals, then you may want to set register_globals = on at runtime so that any subsequent checks by the app will behave correctly. -Rasmus On Mon, 8 Jul 2002, Philip Olson wrote: You cannot set register_globals at runtime via ini_set(). The documentation goes off the PHP4 source which is, to put it simply, a little wrong. The PHP4 source says register_globals is PHP_INI_ALL when in the real world it isn't. .htaccess is as close as you'll get. The ini_set() docs are autogenerated and this issue is being looked into. The correct docs on this are now in phpdoc CVS and will show up soon. In short, don't attempt to set register_globals at runtime as explained by a few in this thread, it won't fully work as expected. Regards, Philip Olson -- 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() broken?
master is the top-level default value set in either your php.ini if you have that file and have a specific value set, or ir not it is the PHP default for the config value. The local is the per-request setting set either in httpd.conf, .htaccess or locally in the script. On Mon, 8 Jul 2002, Philip Olson wrote: Hello Rasmus- How do you suggest ini_set() document these differences? Maybe the table at ini_set() could use another column, for descriptions and notes. Also, could you give a concise description for the differences between local and master values? Regards, Philip Olson On Mon, 8 Jul 2002, Rasmus Lerdorf wrote: Well, you can set it at runtime, it just won't do what you might expect. That doesn't mean that it may not be useful to be able to set it at runtime. If, for example, you have register_globals off and you write an auto-prepend script, or even just a normal snippet of code that you insert into some other app at the beginning that emulates register_globals, then you may want to set register_globals = on at runtime so that any subsequent checks by the app will behave correctly. -Rasmus On Mon, 8 Jul 2002, Philip Olson wrote: You cannot set register_globals at runtime via ini_set(). The documentation goes off the PHP4 source which is, to put it simply, a little wrong. The PHP4 source says register_globals is PHP_INI_ALL when in the real world it isn't. .htaccess is as close as you'll get. The ini_set() docs are autogenerated and this issue is being looked into. The correct docs on this are now in phpdoc CVS and will show up soon. In short, don't attempt to set register_globals at runtime as explained by a few in this thread, it won't fully work as expected. Regards, Philip Olson -- 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() broken?
On Sun, 7 Jul 2002, Greg Donald wrote: This code doesn't work: ? if(ini_set(register_globals, 0)) echo ini_set success; else 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 specific 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. At http://php.net/ini_set it states the following setting is possible: register_globals 0 PHP_INI_ALL Translated, PHP_INI_ALL means: Entry can be set anywhere 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 globals (which must happen before execution begins). Therefore I'd suggest looking into .htaccess or whatever the IIS equivalent is. If there's no equivalent then I'd suggest throwing the server out the window. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Miguel Cruz wrote: ? if(ini_set(register_globals, 0)) echo ini_set success; else 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 specific Uhh.. I don't have any thoughts as to why it doesn't work, that's why I posted. The function itself appears broken, my code is a test to that notion. If you can't be helpful then feel free to shutup.. 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. At http://php.net/ini_set it states the following setting is possible: register_globals 0 PHP_INI_ALL Translated, PHP_INI_ALL means: Entry can be set anywhere 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? globals (which must happen before execution begins). Therefore I'd suggest looking into .htaccess or whatever the IIS equivalent is. If there's no Thanks but I have no idea about IIS, that's why I posted, to see if this might be an IIS specific issue some other windows users experienced. equivalent then I'd suggest throwing the server out the window. Yes.. -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Miguel Cruz wrote: ? if(ini_set(register_globals, 0)) echo ini_set success; else echo ini_set failed; ? [snip] I haven't tried this code, but I assume you're trying to say that ini_set failed is displayed, but you're expecting the other output to be displayed. Am I correct there? What happens if you use http://localhost/file.php?var=something or whatever your test script's path is and have this line at the end of the script echo var = |$var|; does $var contain anything. If it doesn't, then ini_set() worked... otherwise.. um... find other way of doing it(??) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Greg Donald wrote: If you can't be helpful then feel free to shutup.. Please don't attack people who freely give their time to try and help you. Mr. Cruz did not ridicule you in any way but merely asked that you be more specific than, it doesn't work, which is very good advice and a sincere attempt at helping you solve your problem. I can vouch that participating on this list and attempting to give helpful answers takes a great deal of time and there is absolutely no benefit, so try to be more respectful. I refer you to this URL: http://www.tuxedo.org/~esr/faqs/smart-questions.html Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set() broken?
On Mon, 8 Jul 2002, Martin Towell wrote: ? if(ini_set(register_globals, 0)) echo ini_set success; else echo ini_set failed; ? I haven't tried this code Then why comment on it? but I assume you're trying to say that ini_set failed is displayed, but you're expecting the other output to be displayed. Am I correct there? Yes, is it not obvious enough from just reading the code? I am showing that the ini_set() function is not working properly, as per the manual. The manual states that ini_set() returns the old value on success and FALSE on failure. My script always returns false. Any idea why? What happens if you use http://localhost/file.php?var=something or whatever your test script's path is and have this line at the end of the script echo var = |$var|; What does this prove or disprove in relation to the ini_set() function? If you knew anything about the function then you would see I am passing it a big fat zero in the second parameter, just as the manual states I can. I also tried Off and off, same results. does $var contain anything. If it doesn't, then ini_set() worked... otherwise.. um... find other way of doing it(??) Yes.. another way, any suggestions? -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Chris Shiflett wrote: I refer you to this URL: http://www.tuxedo.org/~esr/faqs/smart-questions.html I refer you to this URL: http://php.net/ini_set and ask why does this function not work as per the manual? Again, here is my code: ? if(ini_set(register_globals, 0)) echo ini_set success; else echo ini_set failed; ? -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Greg Donald said: On Sun, 7 Jul 2002, Miguel Cruz wrote: ? if(ini_set(register_globals, 0)) echo ini_set success; else 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 specific Uhh.. I don't have any thoughts as to why it doesn't work, that's why I posted. 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. Absolutely. 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 possible: 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 versions PHP. 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 your code. 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; else 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
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Greg Donald wrote: On Sun, 7 Jul 2002, Miguel Cruz wrote: ? if(ini_set(register_globals, 0)) echo ini_set success; else 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 specific Uhh.. I don't have any thoughts as to why it doesn't work, that's why I posted. The function itself appears broken, my code is a test to that notion. I can see where my wording was ambiguous. By why you think it didn't work, I don't mean the explanation for its failure to function, but rather the experience you had that convinced you it was not working. Obviously something happened to make you decide that it wasn't working. We need to know what that was. Maybe it was an error message. Maybe it was a plume of smoke rising from your computer. Maybe it was some sort of weird behavior of your program. It's just a general thing: We can't read your mind. Or at least I can't. If you can't be helpful then feel free to shutup.. Well, I did go on to answer your question. It could've been worse. 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? Before your code starts, there is a whole bunch of initialization that takes place in the script engine. It looks at its settings to see how it should behave. It gathers all the data that came from the web server (details about the user's request, etc.). It learns about its environment. It populates global variables. Having done these, it starts looking at your code. By this time it's too late to change the way those prior steps were taken. It's like waiting until the plane has taken off (i.e., execution of your code has begun) and then telling the flight attendant you wished it were headed to Chicago instead of Detroit. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Greg Donald wrote: On Sun, 7 Jul 2002, Chris Shiflett wrote: I refer you to this URL: http://www.tuxedo.org/~esr/faqs/smart-questions.html I refer you to this URL: http://php.net/ini_set and ask why does this function not work as per the manual? Again, here is my code: ? if(ini_set(register_globals, 0)) echo ini_set success; else echo ini_set failed; ? Why should I help you when you can't: 1. Follow simple instructions 2. Treat others who have tried to help you with respect. Suffice it to say that ini_set() is not broken; your logic above is. Behave like an adult, and I might explain more. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Mon, 8 Jul 2002, Jason Wong wrote: ? if (ini_set(register_globals, 0) !== FALSE) echo ini_set success; else echo ini_set failed; ? Finally someone interested in helping find my error. Thanks alot! -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
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. Also ini_get('registar_globals') will not return the current state. I have no idea why, it looks like one of those undocumented safety features... Tom At 10:50 PM 7/07/2002 -0500, Greg Donald wrote: On Sun, 7 Jul 2002, Chris Shiflett wrote: I refer you to this URL: http://www.tuxedo.org/~esr/faqs/smart-questions.html I refer you to this URL: http://php.net/ini_set and ask why does this function not work as per the manual? Again, here is my code: ? if(ini_set(register_globals, 0)) echo ini_set success; else echo ini_set failed; ? -- --- Greg Donald http://destiney.com/public.key --- -- 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() broken?
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
Re: [PHP] ini_set() broken?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php