Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106938 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65393 invoked from network); 12 Sep 2019 13:56:35 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 13:56:35 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 9C84F2D20C1 for ; Thu, 12 Sep 2019 04:32:28 -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=-0.5 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 04:32:28 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id d17so15271484wrq.13 for ; Thu, 12 Sep 2019 04:32:28 -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=wMiCqfYQhfIBQwBWVEBR9QjHdKfeK21evIr98D0m8WI=; b=EXYuk0504XgHBbYjXEJd8DSZxfwWxSlYCSoB1JSupqzg8BIggNoZAFkMmifs+gkB7m ZTkvxYku/BNXIj5VhV+ub5Dc4WQzebmREG5cm/bpIpCLB1MyYLbW9clrG6WkgGkc7Lik QgGqg64AFiH9SoWCR3LEuzHEcu+FzOTiLtk+gfa7Q3iz/De4kAtPUO4+AQdLPvKYHz2t 60fzSgmWzyjAqIZ7JcQuvZ4EudJv7Rb/AScmcHUJaNxzCmHPqoRUkKdNP3X8lMV0RjLZ bBgW1VN+5N30/dkEfHQlikbix9H0u6ELTmR+Sto2Q63RFJ5wqByJ8knWqPoAMjaHp7pH W2zA== 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=wMiCqfYQhfIBQwBWVEBR9QjHdKfeK21evIr98D0m8WI=; b=XSTo53MUasFKv2N9Qk6LxJB4Q6d4Z1SHO0Js6TF3KZs4wMcxxfGmhN7Zz3K8JrN1t3 RoQyur4YG4CLnhEeCSduPoZyo2eOMJJuyBiHd1axf7jUrilbGO+OniYCiOAriGykKzUX SsNMyh4Fn3kINxwJXMiDtKj4fMBHmYEb9vFgq4tjAgB9apSB0aQSF17kuBh6H9nsRLbl 0hRoBnfoiwJ6lGSa8PE+iiSjaa/MB0Ve6sFHI137W1Ct7PJSPGaaH5Vt2C3fQrNCz3Rt ILb23EFnHMpWRNSd1hy2ugEO7ad+//V93ZUHixwOgbVrlGWU8I/JaAov/OPT/9tsW9Wh f0Rg== X-Gm-Message-State: APjAAAVHsL85ajE5n1jm5A2ZYmISrByRUvYEdWdAZl5/AHWjs5R4yrIg s+CHAsoKP6tQPbOx6Q4qVTfKMXVCNgqBMjbKjyI= X-Google-Smtp-Source: APXvYqyUGrMy/NLeHH1nRw1igSAWj4qS1DO6YCuAKEUflQsXQbvCeL/hTjxpkCUApjjoH6Fz53rbA2XkytklkZuqCkI= X-Received: by 2002:adf:f801:: with SMTP id s1mr5126439wrp.320.1568287947008; Thu, 12 Sep 2019 04:32:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 12 Sep 2019 13:32:00 +0200 Message-ID: To: Benjamin Morel Cc: Claude Pache , Stephen Reay , Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000fcb0f00592597d83" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: arvids.godjuks@gmail.com (Arvids Godjuks) --000000000000fcb0f00592597d83 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D1=87=D1=82, 12 =D1=81=D0=B5=D0=BD=D1=82. 2019 =D0=B3. =D0=B2 12:32, Benja= min Morel : > > > > For example when I=E2=80=99m writing a throw-away script, some notices = are okay > to > > indicate possible problems > > > Maybe it's just me, but even in throw-away scripts, *I've lost much more > time because of warnings/notices going unnoticed, than I've saved thanks = to > PHP's forgiving nature*. > Hence even in the shittiest of my scripts, I usually end up registering a= n > error handler to throw an exception even for the smallest notice. At leas= t, > I always get an exception right in my face when something's unexpected, s= o > I can fix it and move on, and avoid surprises later on. > > Sure, in a quick script, I do see some value in being able to write stuff > like: > > @ $array['non_existing_key']++; > > It's still sloppy though: what you're really doing is muting a notice and > incrementing null. > Instead, I feel like there should be a stronger support from the language > to specifically handle this kind of use cases, rather than using them as = a > justification for not *severely *hardening error reporting. > I don't think there are that many such *potentially *legitimate use cases= , > so maybe we could just list the use cases and think about a more elegant > solution to solve them? > > In other words, if that was only me, the whole notice/warning stuff would > go, and PHP would only have exceptions. > Undefined variables would throw, undefined array keys would throw, and us= e > cases like the above would have stronger language support to avoid > boilerplate code full of if(isset()). > > =E2=80=94 Benjamin > Every single workplace I worked in past 5 years always had 0 tolerance policy for all notices, warnings and E_STRICT. Since I started PHP in 2005, I have always worked with a 0 warning/notice/strict tolerance policy, in every workplace I have ever worked. All those were fixed as bugs, heck even management pointed out those from logging aggregation and made bugs to be fixed. At this point, if I see that the company does not do this, I skip it. Usually, it is a sign of way more stuff being wrong, but this alone is already enough to have reservations about the advertised position. The world has moved on how software is developed since the early 2000's when this was okay. These days, at least in my dev circle, it is not okay to have notices/warnings in your code. --000000000000fcb0f00592597d83--