Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81310 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79245 invoked from network); 28 Jan 2015 16:42:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2015 16:42:40 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass 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.212.171 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:41805] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/02-44076-B7119C45 for ; Wed, 28 Jan 2015 11:42:37 -0500 Received: by mail-wi0-f171.google.com with SMTP id l15so13240252wiw.4 for ; Wed, 28 Jan 2015 08:42:33 -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=BnQTjKz2vRZlOMcunv1rNLIKGpM6TtqGMzNuogyP+nU=; b=yusqZqEUJa3uYcb7jdlE3x1JDwppYiFVHrxv7fp3gfi6XGW2EtCnwE+2S1z3X27OP1 3Uu1iTCBkRRe+vjyUbV4RAIN53nw1Ip/5DoxkZzbTEQous2SwH3aaeCgIQdlAb5FcWT8 u7FEUqH52PGtaneQruR45OcpemK1zwwy5KvWL8//v9qnBSfM8y4xTEEKWcxhDrgtoMhK kIwxv2uwrXM9O1k5zLSpeinkbuuxliIaofeCfSyn9ZMKDKjQ3QhpDoSOSPBwwb+j+sNQ TNy3XrEl2hNuBwMztNIXxqHp84h79IvK+Bk6NuGBknv4S13gyTOVS47PiFrpu6LxmzTN qOKw== MIME-Version: 1.0 X-Received: by 10.194.88.131 with SMTP id bg3mr8720332wjb.99.1422463352976; Wed, 28 Jan 2015 08:42:32 -0800 (PST) Received: by 10.180.88.33 with HTTP; Wed, 28 Jan 2015 08:42:32 -0800 (PST) In-Reply-To: <54C90367.5010903@gmail.com> References: <54C80F4F.7020905@gmail.com> <011d01d03ab7$dd725c30$98571490$@tekwire.net> <54C8BE99.8070109@gmail.com> <54C90367.5010903@gmail.com> Date: Wed, 28 Jan 2015 17:42:32 +0100 Message-ID: To: Rowan Collins Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e010d849edc3ab5050db90eb7 Subject: Re: [PHP-DEV] Proposal: Raise severity of undefined constants From: tyra3l@gmail.com (Ferenc Kovacs) --089e010d849edc3ab5050db90eb7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Jan 28, 2015 at 4:42 PM, Rowan Collins wrote: > Ferenc Kovacs wrote on 28/01/2015 12:13: > >> >> E_DEPRECATED is likely to be even more ignored than E_NOTICE, so >> would be a step backwards; my whole assumption is that most people >> getting the message are not using a deprecated feature, but >> accidentally mis-typing a constant or keyword. I'd be happy with >> raising it to E_WARNING to make it more noticeable, though, if we >> don't think removing the functionality is acceptable. >> >> >> turn it into E_WARNING if we are planning to keep the feature, turn it >> into E_DEPRECATED if we want to remove the feature later on. >> > > I see absolutely no advantage in changing this into E_DEPRECATED, as it's > even more likely to be hidden or ignored than E_NOTICE. > removing a feature (which is present in the language since 4.0, probably even previously) without marking it deprecated first would be a rude move imo. so if we want to remove it, I can't see any other way. > > There are actually two parts to the message: that you used an undefined > constant, and that PHP interpreted this as you wanting a string. If you > really intended a string, then "deprecated" is relevant; but if you > intended a keyword or constant, then there is nothing to deprecate, it's > just an error. > yeah, the problem is that we can't tell, what was the intention from the author, so while I can see how this behavior can cause huge WTF moments for our users (http://3v4l.org/QW8qV), but there are still a bunch of code out there relying on it. having a php version where it is E_DEPRECATED allows people to upgrade to that version, log the deprecated messages and fix their code. (ofc. you can also try to detect this specific usage with static analysis, but that would still miss dynamic usages like eval). > > If we want to keep the string fallback for now, how about we raise the > severity to E_WARNING, and change the message to mention deprecation? > e.g. > Warning: Use of undefined constant foo - assumed 'foo', but this behaviou= r > will change in a future version I don't like mixing the deprecation notice in the string but maybe it's just me. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --089e010d849edc3ab5050db90eb7--