Click to See Complete Forum and Search --> : Update from 4 to 5... lost use of globals.


amPAR
01-03-2006, 11:24 PM
Okay, I updated my php from 4.1.1 (I think) to 5.*. Anyway, I went through the ini and there is a piece of code that said...

register_globals = Off

I changed it to

register_globals = On

Which I know just made it so that I can use $data instead of $_POST[data]... etc.

Which really didn't help me because I always try to use $_POST, $_REQUEST, $_SERVER anyway. I know globals are bad but the way I'm using them doesn't cause any security issues as far as I can tell. However, here's my problem.

Now that I have updated the following code will no longer display the variable.



$output = "cheese danish";

function food ()
{
global $output;

echo "You're eating ".$output;

}

food();




This merely would echo:

You're eating

when before It would have echoed:

You're eating cheese danish.


I'm guessing there is still something wrong in my php.ini but I can't seem to find it.

Any help is much appreciated. Thanks.

bpat1434
01-06-2006, 05:57 AM
hmm... works for me. PHP 5.1, Apache 2, Windows XP.

I didn't change anything in my php.ini except uncommenting and such.

Not sure what it could be. Is your error reporting level enough to show errors? If not, see if you're getting an error (though you shouldn't be).

~Brett