ID: 29562 Comment by: okuhl at netcologne dot de Reported By: darcy at 1000camels dot com Status: Open Bug Type: Scripting Engine problem Operating System: Linux, MacOSX PHP Version: 4.3.8 New Comment:
For me, using "$GLOBALS['var']" works fine instead of using global $var. Previous Comments: ------------------------------------------------------------------------ [2004-09-08 16:21:44] darcy at 1000camels dot com i got around this problem by globally defining all the variables which are to be used with a global scope. so, just before the include statement, setup your global $variable1, $variable2. this seems to work fine in my case - i was working with phpBB2, which i was trying to try into a CMS i'm working on. It worked fine for phpBB2. i suspect that other code might have trouble with this kind of fix. ------------------------------------------------------------------------ [2004-09-07 13:54:07] mxou at mycosmos dot gr I've also encountered the same bug and was searching if someone had encountered it so far. Not only my own global variables are of no scope, PHP's superglobal structures become out of scope, also. Very irritating. ------------------------------------------------------------------------ [2004-08-11 06:22:07] darcy at 1000camels dot com does anyone have any more information on this? i'm finding it quite difficult to work around this problem. i've tried making an absolute call with the include (ie. using http://), but that's just causing more trouble. i can't get access to the cookies from within an absolute call... And the fix i described above doesn't really help, since i'm trying to source a rather large piece of code (phpBB2), which has lots of globals. too many to keep track of. besides, i don't think it's the best approach... ------------------------------------------------------------------------ [2004-08-10 09:57:30] cstdenis at on-track dot ca Looks like this is happening with PHP5 (release) too. ------------------------------------------------------------------------ [2004-08-09 19:05:59] darcy at 1000camels dot com i did some more experiments and have found a kind of fix. It would appear that if i globalize any of the variables which are losing scope inside of the function which sources the code, the variables keeps scope. this is interesting and may help me do what i need to do, but i still think this is a problem. if you want to see an example of my fix, look for the files called -fixed on my server: http://1000camels.com/phpBug/ ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/29562 -- Edit this bug report at http://bugs.php.net/?id=29562&edit=1