Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106944 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99838 invoked from network); 12 Sep 2019 16:15:17 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 16:15:17 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 78B3B2D1F81 for ; Thu, 12 Sep 2019 06:51:08 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Thu, 12 Sep 2019 06:51:07 -0700 (PDT) Received: by mail-vs1-xe2e.google.com with SMTP id g11so15871147vsr.8 for ; Thu, 12 Sep 2019 06:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Wpp1T4/VePzNVEWeI1XfJWitkOKusfvB1JiqDMwSdrA=; b=PMYb7tUiRF1xoxw8V0ZrTKfuqZXfiR/vI3uPTLZ/XWwp+pIW6uRoJvUC5YNhKzXvnQ 1XU6cw4e2Uwt/zR2pltOmvqobZhPXMIrIC+DKrvYAbkKGp+GZ+gNHrxMQUirNwtgRdTO mDGquezS6IC76V1B3z5QNxekEOFvbzcOnJVroTN467XJIkapGAiIkXnz7K/tc3Qo0V99 yn4TgR41wXjqiwcemMpB9Y8wQXWz5q/XkMUPQc8L7TDKRWu3P8MTpSdhYfcEMk0tYI7s wMFCvOPwyhTsMjJMUAgLEfD5Xmka7CSW2irMh/e88YCpb68rRfDBWnRT+wfKAC7D2JzO 2ZBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wpp1T4/VePzNVEWeI1XfJWitkOKusfvB1JiqDMwSdrA=; b=EdNsQYRMNnIanLY1BM6H2TtkmyXbut4nVA45vNtWtws9VCfBtrfA4ah5XwiuEbn9+I 8YO3yZw9/KAlfU0g5I+EvrSjzWNVcN41TNwNQaXY+kkyfqs9z3ukAvUP9twztUbAQ3fq DvnklpuOv6ruUacNFyqJiGPRluRUu5mJabaWpcvkSvWO5FJBqzLJvfEwetQ/N+SoxdQe T6G13bMCFrZPOAh+YdWkyKg+TiA2/pBpO0xPEJFZBWnwhVtKhzGB5HJTvhed2DXkAn4j +kYkIPQQoac31MKK77Chm/QI2vOKxHDQmBiuORIV3Qqp5MzdVMC3YFYue2wcuZddJ6mG VPhA== X-Gm-Message-State: APjAAAWQaj3UrNEM5xidmX1lV+saBvByRKrDCNITYRXqxbxvOXRzCqnF QMSHCc6C8V4l8xZvYBr3wRpEISdQUtvFQ12g0rU= X-Google-Smtp-Source: APXvYqzD9d92/m+U11unVxyw1DxQMRE6i0snhXI0QO/Cy22iNfqfVl8EyDe5pkncPKs9ePijfzpT2pKhh8vyo5dLKUI= X-Received: by 2002:a67:ec14:: with SMTP id d20mr23217031vso.209.1568296267240; Thu, 12 Sep 2019 06:51:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 12 Sep 2019 09:50:55 -0400 Message-ID: To: Claude Pache Cc: Stephen Reay , Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000e95a0605925b6d81" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: chasepeeler@gmail.com (Chase Peeler) --000000000000e95a0605925b6d81 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 12, 2019 at 5:41 AM Claude Pache wrote= : > > > > Le 12 sept. 2019 =C3=A0 10:17, Stephen Reay = a > =C3=A9crit : > > > > > > > > I=E2=80=99ve seen a number of people that have concerns about PHP throw= ing > actual errors (as opposed to notices) because they try to use a > variable/offset that doesn=E2=80=99t exist, and of course there is often = a proposal > to have a declare statement or something similar, to allow their =E2=80= =9Ccode > style=E2=80=9D to run without errors. > > > > > > So, my proposal to the situation is to introduce a single declare that > solves that problem, once and for all. > > > > > > declare(sloppy=3D1); > > > > > > This would suppress any errors about undefined variables, array offsets= , > would reverse the =E2=80=9Cbare words" change when encountering an undefi= ned > constant, etc. Heck, for good measure this mode could even re-implement > register_globals and magic_quotes, because why not? > > This still forces people to opt-in to something that has been supported for 20+ years, and there isn't even a consensus on it being "sloppy" to begin with. > > > > > > If you want to write sloppy code, that is entirely your prerogative, bu= t > please just own it for what it is, and stop pretending that it=E2=80=99s = some > herculean task to either define variables/offsets first; or check if > they=E2=80=99re defined; or use an appropriate method to access them that > specifically allows for undefined variables/offsets (i.e. the ?? and ??= =3D > operators) > > > > > > Declare(sloppy=3Dyeah) is not granular enough. To all: please, do underst= and > that everything is not black or white; this remark is not directed > specifically to that particular issue, this is an attitude I see regularl= y > on that mailing list. > > There is no such thing as =E2=80=9Cone true strict coding standard=E2=80= =9D and =E2=80=9Cone > legacy lax coding standard=E2=80=9D. For instance: > > * As time passes, we learn by experience what features were plain blunder= s > (magic_quotes?), what features should have been more strict for the sake = of > catching bugs without imposing too much burden on users, what features > could have been more strict, although that would impose to write lot of > boiler code, etc. This process does not belong exclusively to some past > dark age of sloppy and unsecure coding practices. > > * The degree of wanted strictness vary depending on occasions. For exampl= e > when I=E2=80=99m writing a throw-away script, some notices are okay to in= dicate > possible problems, but I=E2=80=99m not going to write boilerplate code (o= r, worse, > put a @ in front of everything) just for the sake of silencing them. (But= I > *certainly* do not want stupid things like mistyped constants converted t= o > string literals.) On the other hand, when I=E2=80=99m writing a critical = part of an > application, I am careful to write down everything precisely, and having = to > write explicitly and once for all that, yes, this precise variable must > have that default value, is a minimal part of the time passed to write, > re-read and review the code. > > What??? You mean it's possible to write strict code even when the engine doesn't force you to? But I got the feeling that wasn't possible and we needed to force EVERYONE to code this way. > =E2=80=94Claude > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Chase Peeler chasepeeler@gmail.com --000000000000e95a0605925b6d81--