Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50938 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88048 invoked from network); 9 Dec 2010 11:21:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2010 11:21:20 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.173 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.161.173 mail-gx0-f173.google.com Received: from [209.85.161.173] ([209.85.161.173:34534] helo=mail-gx0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/75-61607-AABB00D4 for ; Thu, 09 Dec 2010 06:21:14 -0500 Received: by gxk24 with SMTP id 24so1195052gxk.18 for ; Thu, 09 Dec 2010 03:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=sGoo8JG246fOzr/wupyddehjQ8r8alWNJoe39Zxb8VM=; b=opqfZSooXVsiYTqO/rf82tDnv3sl+Vx+PIfhAVB0+6AJjtvbIDVLC4VpikYlJVHfVF Gw6BowxCkG3N+TdSHhq7cw7agpNSp5IK+ayRzqEj3Ft4V8uVYCb+cWpBFT0oirfq6PJZ ezO6u1DH6T0Y3mXEaGUh2M/yd0i1gbgvknXZU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=ie+4WQr1fzEd+EHt67ZQIKoRtbie/faXgBtl5aw5Oeb5jNNsEA5CUeqgsUPleVZMqB Js7Zrk66/BE/mbz8AJFDXW9vIEuu2XeVmeCLypfxIHqjP6kyg8ODH5lyJFwgVYZtyMOJ U+Y9Y2DzqBDBHUtKCg4N+lPRftgkM6VMDlI9s= MIME-Version: 1.0 Received: by 10.90.35.5 with SMTP id i5mr2319460agi.141.1291893671733; Thu, 09 Dec 2010 03:21:11 -0800 (PST) Sender: tyra3l@gmail.com Received: by 10.90.53.4 with HTTP; Thu, 9 Dec 2010 03:21:11 -0800 (PST) In-Reply-To: <4D00ABFE.5070403@hristov.com> References: <4D00ABFE.5070403@hristov.com> Date: Thu, 9 Dec 2010 12:21:11 +0100 X-Google-Sender-Auth: vt-OYt7DIJJPfYtWrjOxBzQqZ4g Message-ID: To: Andrey Hristov Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001636283b16642cf20496f86f8a Subject: Re: [PHP-DEV] Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only From: info@tyrael.hu (Ferenc Kovacs) --001636283b16642cf20496f86f8a Content-Type: text/plain; charset=UTF-8 On Thu, Dec 9, 2010 at 11:14 AM, Andrey Hristov wrote: > Hi guys, > the topic says most of it. What do you think about deprecating the global > keyword and $GLOBALS with it? Together with this making $_REQUEST, $_GET and > $_POST read-only as they should be used only to read-only anyway. > > The reason for global + GLOBALS is that these are abused and which leads to > spaghetti programs, when used by unexperienced users. Also they have impact > on side effects from functions that don't only rely their parameters. > > Best, > Andrey > > Please next time write an rfc before starting a thread like this. I'm pretty much against the idea. That would be the most dramatic change in the language in the history of php. The register_globals is/was a much bigger problem/bad practice and it take 10 years to remove it(we are almost there...). And to fix the applications, one would either completely restructure all of the functions/methods to pass all of the required data from the global scope, or they would do the easy way: export all of the global variables into a singleton registry. From a Framework point of view, they should save all of the (super)global variables from the global scope, because the frameworks doesn't use/run code in the global scope except the bootstrap, so they couldn't access that either, but they won't know what the developer who uses the framework want's to access from the global scope. And what about global constants? They are also screwing up the Dependency Injection, and the static functions/properties, and the singletons also. Should we ban those? Tyrael --001636283b16642cf20496f86f8a--