Re: superglobals

From: Date: Fri, 09 Apr 2004 15:31:09 +0000
Subject: Re: superglobals
References: 1 2 3 4  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-544@lists.php.net to get a copy of this message
I looked into just this thing a couple months ago and (Davey Shafik wanted to create an _APPLICATION superglobal to make supersessions that would be shared amongst all users of a particular application). Unfortunately, what Wez just stated is absolutlely the case. Any superglobals must be defined *prior* to compile time so registering superglobals from within an application (via something like superglobal_create('_FOO'); ) would not work. The best you'd be able to manage would be to create an .ini option to specify superglobals you want defined. Further, such a module could not be loaded by dl(), but would have to be loaded in an extension directive (or compiled in staticly). php.ini: extension=php_superglobals.so superglobals.user = _FOO, _BAR, _BAZ, _APPLICATION, _ASPECT, etc.... <?php $_FOO = "Foo"; function bar() { echo $_FOO; } bar(); -Sara "Wez Furlong" <wez@thebrainroom.com> wrote in message news:052201c41e1a$da802270$8a02a8c0@tron... > as I recall, superglobals are resolved at script compile time, so > a superglobal() function you can call from PHP won't be possible. > > You can add your own superglobals in your extension; however, since > this isn't really going to meet the needs of others, it probably > won't make sense to put it into PECL. (unless you have a really > cool useful idea ;-) > > --Wez. > > ----- Original Message ----- > From: "Robert Cummings" <robert@interjinn.com> > To: "Andrey Hristov" <php@hristov.com> > Cc: "Jackson Miller" <jackson@tekzen.net>; "PHP-PECL" > <pecl-dev@lists.php.net>; <marcus@skysaber.com> > Sent: Friday, April 09, 2004 11:00 AM > Subject: Re: [PECL-DEV] superglobals > > > > On Fri, 2004-04-09 at 05:45, Andrey Hristov wrote: > > > Jackson Miller wrote: > > > > Please excuse me if this is not an appropriate forum for this > question. > > > > > > > > The short question is: > > > > Is it possibly to create a PECL extension for PHP that adds a new > (empty) > > > > superglobal variable? If so, then I am assuming it would be possible > to > > > > create a PECL extension for adding a superglobal() method. > > > > > > > > I know this question has been discussed on php-dev a few times, but > those > > > > discussions have resulted in no solution (and I was not part of those > > > > discussions). > > > > > > AFAIR it was decided that adding such a function is a bad idea. > > > > PECL is about special needs though, is it not? I don't see why an > > outcome decided by internals should affect something in PECL. Is it > > possible anyways to added a new super globals entry via an extension?

« previous php.pecl.dev (#544) next »