Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82562 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76990 invoked from network); 12 Feb 2015 21:45:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Feb 2015 21:45:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.177 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 209.85.214.177 mail-ob0-f177.google.com Received: from [209.85.214.177] ([209.85.214.177:43333] helo=mail-ob0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/82-61903-4EE1DD45 for ; Thu, 12 Feb 2015 16:45:08 -0500 Received: by mail-ob0-f177.google.com with SMTP id wp18so12560261obc.8 for ; Thu, 12 Feb 2015 13:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GkCTq+S+JzfRHGcOnPHBK5ALaILARVTzG6GQ+FAFzO0=; b=ueUu0Ec1PSWZvh+OuBwSHrh/C3cG6oal/43f8XR7raTpfEuMMDGdMXZbs05fM0YYuV bXgpeq2pzPwWM5vQ1i9L7SRKzrvch+IxiuabGSATl9DP14ZPIeZ898TV/V1xlhxNZzWZ peYYuguux5OBccMxzY4loos7yKdzKJX+i96sNPChzbmO08OdIcfeSGpeKspLhUOlptRD 5JFtcTAjUwkENdcdQ0Eyw5kJDIRrypJr1bWY0bWMrxhLamqMhyk6P18x8JwQqgn/grbf NECHBg/YIjpKm1RtwKzq+YIaID7ZhcMwuKnvZVeFpoNUtHYYhOyWD0NjHOYnYXAG57qr ZilQ== MIME-Version: 1.0 X-Received: by 10.60.129.168 with SMTP id nx8mr4390904oeb.82.1423777505455; Thu, 12 Feb 2015 13:45:05 -0800 (PST) Received: by 10.202.65.136 with HTTP; Thu, 12 Feb 2015 13:45:05 -0800 (PST) In-Reply-To: <54DCDA71.8070201@gmail.com> References: <006b01d046d4$0674e6c0$135eb440$@tekwire.net> <54DCDA71.8070201@gmail.com> Date: Thu, 12 Feb 2015 13:45:05 -0800 Message-ID: To: Rowan Collins Cc: PHP internals list Content-Type: multipart/alternative; boundary=047d7b417cbb73b3d9050eeb0864 Subject: Re: [PHP-DEV] Remove $this from incompatible context From: kris.craig@gmail.com (Kris Craig) --047d7b417cbb73b3d9050eeb0864 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Feb 12, 2015 at 8:53 AM, Rowan Collins wrote: > Fran=C3=A7ois Laupretre wrote on 12/02/2015 14:56: > >> Sorry to get off-topic but could we raise the 'undefined variable' error >> to E_WARNING, at least ? E_NOTICE seems very low for such an error. >> > > I think the division between E_NOTICE and E_WARNING is a bit arbitrary > sometimes, but without a good definition of the difference, I think it's > unhelpful to introduce "inflation" by raising severities. Don't forget th= at > while an undefined variable is sometimes an error, it's sometimes just po= or > coding style, and the user is consciously relying on the implicit null > (e.g. $count++, or $hash[$key] =3D $value, or even echo $hash[$key]). > > Perhaps what's needed is a survey of current messages, and an RFC to > reclassify them based on some consistent definitions? > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I would also like to see undefined variables escalated to E_WARNING. Even though it is often bad coding style, it's also frequently just an oversight on the part of the developer; an oversight that can lead to unexpected results. Since it's very common for environments to display E_WARNING but not E_NOTICE, some devs-- particularly those who are less experienced in PHP-- can end up wasting a lot of time trying to chase down the behavior because they're not seeing any errors. Besides, making it only an E_NOTICE, we're encouraging people to develop bad habits that can and do lead to all kinds of problems down the line. I know many devs who erroneously believe that declaring variables is actually discouraged in PHP. When I point out that not declaring a variable will throw a notice, they always seem surprised; something along the lines of, "Oh yeah I never see those." Given the problems that can arise from this, I think that's reasonable justification enough to make this an E_WARNING instead of E_NOTICE. --Kris --047d7b417cbb73b3d9050eeb0864--