Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33187 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71665 invoked by uid 1010); 17 Nov 2007 00:41:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 71650 invoked from network); 17 Nov 2007 00:41:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2007 00:41:34 -0000 Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:35059] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/03-51194-EB83E374 for ; Fri, 16 Nov 2007 19:41:34 -0500 Received: from [216.15.51.211] (port=50294 helo=[192.168.1.90]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1ItBkd-0006tL-Cd; Fri, 16 Nov 2007 18:41:35 -0600 To: Michael McGlothlin Cc: internals@lists.php.net In-Reply-To: <473E349E.3050704@swplumb.com> References: <8D.46.01128.768AD374@pb1.pair.com> <1195246391.21084.15.camel@sbarrow-desktop> <1195250285.4012.6.camel@johannes.nop> <1195251014.21084.20.camel@sbarrow-desktop> <473E349E.3050704@swplumb.com> Content-Type: text/plain; charset=utf-8 Date: Fri, 16 Nov 2007 19:41:34 -0500 Message-ID: <1195260094.10547.11.camel@sams-room> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: quoted-printable X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Re: Question about superglobals From: sam@sambarrow.com (Sam Barrow) If anyone wants the patch, you can get it from my blog at http://www.sambarrow.com/. Keep in mind however I only tried it with PHP 5.3, I don't know if it will work on 5.2, as I am trying to transition to 5.3 completely because it has namespaces. On Fri, 2007-11-16 at 17:23 -0700, Michael McGlothlin wrote: > I think the superglobal keyword is a great idea. I have a custom class=20 > that implements a custom interface to memcache with a MySQL backend for=20 > data that drops out of memcache or is to big to be stored easily in=20 > memcache. I get annoyed at needing to include a global statement in=20 > every place I want to use memcache. > > Thanks everyone, I knew this, but I didn't want to use runkit because i= t > > is a beta, and i don't want all that other stuff, just superglobals. > > Also, runkit only allows you to use php.ini, but my patch allows you to > > specify superglobals in your script with the keyword "superglobal" by > > saying: > > > > superglobal $var1, $var2 ; > > > > Thanks for your help though, if anyone else is interested in the patch > > send me a message.=20 > > > > This isn't something the developers would want to implement I assume, > > but it would be useful if they would, at a very small cost too (the > > patch probably under 50 lines, very simple code too). If anyone would > > like the patch to be implemented in CVS, let me know. > > > > On Fri, 2007-11-16 at 22:58 +0100, Johannes Schl=C3=BCter wrote: > > =20 > >> Hi Sam, > >> > >> you could use pecl/runkit for registering your own super globals. See > >> example 2071 on http://de3.php.net/manual/en/ref.runkit.php > >> > >> johannes > >> > >> On Fri, 2007-11-16 at 15:53 -0500, Sam Barrow wrote: > >> =20 > >>> I am trying to develop a patch for personal use to enable custom > >>> superglobals. > >>> > >>> I seemed to have had it working, but am I allowed to specify > >>> superglobals in my script, or do they have to be specified in an ini > >>> file or statically in the PHP code?=20 > >>> > >>> I created a superglobal keyword and a function that calls > >>> zend_register_auto_global upon the use of this keyword, but it doesn'= t > >>> work. It calls zend_register_auto_global correctly and passes the > >>> variable name and length of the variable name, but when i try to acce= ss > >>> the variable inside a function in my PHP script, it is undefined. > >>> However I am able to hard code my superglobal into the PHP source fil= es > >>> and it works. > >>> > >>> Is there some type of restriction on setting superglobals at runtime,= or > >>> does the structure of the PHP interpreter not allow this, or am I doi= ng > >>> something wrong? > >>> > >>> Thanks in advanced for your help. > >>> =20 > > > > =20 >=20 >=20 > --=20 > Michael McGlothlin > Southwest Plumbing Supply >=20 >=20