Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27995 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70723 invoked by uid 1010); 11 Feb 2007 06:15:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70708 invoked from network); 11 Feb 2007 06:15:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2007 06:15:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain l-i-e.com from 67.139.134.202 cause and error) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:1352] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/1A-22659-894BEC54 for ; Sun, 11 Feb 2007 01:15:53 -0500 Received: (qmail 38955 invoked by uid 98); 11 Feb 2007 06:15:57 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-1.25 (clamdscan: 0.88.7/2546. Clear:RC:1(127.0.0.1):. Processed in 0.077856 secs); 11 Feb 2007 06:15:57 -0000 X-Qmail-Scanner-Mail-From: ceo@l-i-e.com via o2.hostbaby.com X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.077856 secs) Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 11 Feb 2007 06:15:56 -0000 Received: from 209.254.223.2 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Sun, 11 Feb 2007 00:15:56 -0600 (CST) Message-ID: <4663.209.254.223.2.1171174556.squirrel@www.l-i-e.com> In-Reply-To: <45CBD1C0.9080905@cschneid.com> References: <45CBD1C0.9080905@cschneid.com> Date: Sun, 11 Feb 2007 00:15:56 -0600 (CST) To: "Christian Schneider" Cc: "Guilherme Blanco" , internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Suggestion: global variables being accessed in localscope From: ceo@l-i-e.com ("Richard Lynch") On Thu, February 8, 2007 7:43 pm, Christian Schneider wrote: > Guilherme Blanco wrote: >> Brian,I am sorry about the message indentation... Seems >> PHP-Internals >> list does not like M$ Live(r) Mail! > > Please use plain text mail as your messages are a PITA to read, > thanks. Or very easy to read, as the spam filter just junks it... :-v >> you can see, the only change needed is in a throw-able error >> (Undefined >> variable), which does a second look-up in the symbolTable.Doing >> this, you do not need to use $GLOBALS nevermore! And also, global >> can > > You didn't grasp two of the major PHP features (not bugs!): > 1. Every variable you access inside a function is local unless > explicitely imported (through $GLOBALS, global or superglobals) from > the > global scope. And that's the way it should be, unless you really like tracking down obscure bugs from totally unrelated code messing with your variables. > 2. Accessing undefined variables is normal and not an error (not > everybody agrees here but lots of people consider this a big plus). Actually, it's not at all normal, and PHP throws an E_NOTICE. It's your own fault if you haven't turned that on in your error_reporting. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?