php.net |  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
Votes:8
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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?

Patches

Pull Requests

History

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] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: Scripting Engine problem
 [2010-12-14 12:13 UTC] jani@php.net
Yes, you have $GLOBALS.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 06:01:29 2025 UTC