ID: 16185 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Feature/Change Request Operating System: WinXP PHP Version: 4.1.2 New Comment:
That new method makes the problem less common but it still occurs. Shouldn't PHP produce an error rather than hang anyway? I have been working on this for 3 hours and I still have the PHP lockups, but it's very unpredictable and I can't seem to find a concise sample to repro. It's very strange because it doesn't appear to hang on that line, but rather on very innocent stuff long afterwards. I'm giving up on it for now, but this may be something you guys want to look into further. Previous Comments: ------------------------------------------------------------------------ [2002-03-21 11:20:34] [EMAIL PROTECTED] ok, try this then: foreach($GLOBALS as $key => $value) if($key != "GLOBALS") global $$key; ------------------------------------------------------------------------ [2002-03-21 10:56:47] [EMAIL PROTECTED] Interestingly, the one-line solution for accessing globals seems to be causing PHP.exe to hang. I have narrowed it down to the following code which makes php die under WinXP (at least it does here) <? session_start(); session_register("Ses"); $Ses->UserAdvanced = true; function test() { foreach($GLOBALS as $key => $value) global $$key; // get access to all globals } test(); ?> ------------------------------------------------------------------------ [2002-03-20 18:18:19] [EMAIL PROTECTED] Thanks for the suggestions, I think I will stick all my globals in a structure since this won't be changed. I agree that globals are not good in an object oriented language, but I still disagree about this - I would venture to guess that PHP is used mostly for small scale scripting, and the needs of the many - smallness and simplicity - outweigh the needs of the few poor saps who are trying to write an OS with it. ------------------------------------------------------------------------ [2002-03-20 10:44:42] [EMAIL PROTECTED] bogusified ------------------------------------------------------------------------ [2002-03-20 10:44:04] [EMAIL PROTECTED] #1 don't use globals. period. we are *not* going to change the language to support bad design techniques #2 you can get all global symbols by doing foreach($GLOBALS as $key => $value) global $$key; ------------------------------------------------------------------------ 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/16185 -- Edit this bug report at http://bugs.php.net/?id=16185&edit=1