Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:5491 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84215 invoked by uid 1010); 16 Nov 2003 11:26:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84191 invoked by uid 1007); 16 Nov 2003 11:26:06 -0000 To: internals@lists.php.net Message-ID: <3FB75ECD.4000703@cschneid.com> Date: Sun, 16 Nov 2003 12:26:05 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031009 X-Accept-Language: de-ch, de, en-us, en MIME-Version: 1.0 CC: php@mahono.de References: <3F47BEA9.6000105@mahono.de> In-Reply-To: <3F47BEA9.6000105@mahono.de> X-Enigmail-Version: 0.76.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 195.226.4.61 Subject: Re: feature request: user-defined superglobals From: cschneid@cschneid.com (Christian Schneider) Matthias Nothhaft wrote: > declare_superglobal($_MYVAR); Has one single superglobal $_APP (or $_USER or the like) already been discussed? (Sorry Andi, couldn't find it in this list and didn't find the 'engine2' list you were referencing at all). I second Matthias that some sort of user-controlled superglobal would be useful in frameworks, even if it was only one. Stefan Walk wrote: > global $_MYFW; I consider global the worst option ever as is has to be repeated inside every function. Redundant and bug prone. $GLOBALS['_MYFW'] is a bit better but very ugly and a pain to use. Timm Friebe wrote: > MYFW::getInstance()->method_a(); Very clumsy. There's a reason why I'm not using Java! (-:C And no, it does _not_ work with PHP4 and excuse me, but PHP5 is far from being deployed at your friendly ISP. Don't fool yourselves, PHP4 will be around (and has to be supported by people writing PHP frameworks) for quite a while. An $_APP superglobal wouldn't allow multiple frameworks to coexist but I think there'd be enough uses to justify it. It'd for example allow me to turn $_REQUEST into an object, i.e. I could use $_APP->id instead of $_REQUEST['id'] which is so much nicer to use. And no, I don't use form variables with names that aren't valid PHP identifiers ;-). The abuse of $_SESSION for this was already condemned and I'd be uncomfortable to use $_REQUEST (or one of it's siblings) itself. Ok, ready to take the beating, - Chris