|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12669 Utterly Global Variables - What Zeev was talkin about
Submitted: 2001-08-08 21:16 UTC Modified: 2010-12-14 12:13 UTC
Avg. Score:4.8 ± 0.4
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:4 (50.0%)
From: btanner at home dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.0.6 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: btanner at home dot com
New email:
PHP Version: OS:


 [2001-08-08 21:16 UTC] btanner at home dot com
"The new variables are auto-globals - they're available in all function contexts" - Zeev

How hard would it be to allow a construct so that a developer could indicate that one or more variables was available in all scope.

I have a big "Enviroment" class that does everything from data processing, security, access control, page rendering, etc, etc, etc.  Its a huge pain to pass around a handle to my "$Env" variable all the time.  If the access control list needs to check something about the user, or the page needs to know which template it should be rendering, I need to traverse my heirarchy via this handle.  I'm tired of having references to it stored everywhere ;)

Any chance of getting this?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-28 20:22 UTC] roberto at berto dot net
There are other requested that is duplicated from this one: #14712
 [2003-01-30 06:02 UTC] nobs at tigress dot com
Hope I got this idea right: What I want is a "super-static" variable available for a script at any time. In other words: a variable that is static on script-level and not on function level. Currently I am using a constant-named session without cookies, but of course this is kinda hacked workaround.
 [2010-12-14 12:13 UTC]
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: Scripting Engine problem
 [2010-12-14 12:13 UTC]
Yes, you have $GLOBALS.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 01:03:36 2022 UTC