Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107095 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77047 invoked from network); 14 Sep 2019 23:42:35 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 14 Sep 2019 23:42:35 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 981E12C0458 for ; Sat, 14 Sep 2019 14:19:03 -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 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-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 ; Sat, 14 Sep 2019 14:19:03 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id s28so32487922otd.4 for ; Sat, 14 Sep 2019 14:19:03 -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=gRpIg2YySFC4WzCcIy89VmXw3w8rBL46EZ25yiZgWoo=; b=sO+FmU63jY0OtGu5jsg8niBVYMubolhA7YE3pRgygPPqVdeI9n7EdtafQHzs/tSjMz ozgw2zlpILRdUipcW3nnTMCTlfBXeYadtesjQ+YDzQlozBZhmfrEdPuCmpiXvnXGFWxd ul1yGgTI/2bOq7xU9eB1/nki9k41LchqtrEHsdhuiVFivwIv+wR+/t4F53jW5YD1x4XB pnqxGIjZculnzCYV6TQQ+xLzWAJ4n/c9p55OAL6qD4iQiA4tJephltX/iahnwYzglv6D CTEaEsycBGb6GXNwR8xeINUFuaorUc7inAg/sHhMDfvDfPT9yGNHwJg8fFm+0UN/rjAH 4/Kg== 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=gRpIg2YySFC4WzCcIy89VmXw3w8rBL46EZ25yiZgWoo=; b=QYHkYi4IQ0Q4+yn1FaH0+wggXqNC2F5EgP6+pN2pKJ8uNq1p2CSAW46H3a7C3gxzNT D0GkxgRH/L1xcG7Gxla45vpr43ltV1oSxPlAXKPTlM/OP3Nyft8BCnOvGQCrEAEJgC1F Z7A7WE5xHPM1zQafiBiobK085J2QMVa3m4x3wkxEWdBYfRq1SYqr/1y3Rp/Hs1/lDDCk ZkeqNO6xqK1obA5vVDqlojctMi7TVl2+tot5tQBrQyhzG4eY0I+i/MT/0JHwdvfJOO+K hO3CAbNsfnmRVyIMM7hhB8Gjq4MCv88xU/xunVk55fdMGfLUa4ZCz2C6jbCNPHUGRqj4 2IVg== X-Gm-Message-State: APjAAAXFo8XIOhKwOhzrcjYa0abMDVHlhe+nv1BxJbRQlE6IqYM3i7N0 ryipwMf0ZQCHTJaw2UxLayiol+S5fiB7okpO/2c= X-Google-Smtp-Source: APXvYqwAF7cDs3Oynq9W6IEpKqtrLhx9KeLjIiPeswzs1N+5f84jQLJuF2kJLp5sOEHl48WOBFZswd7Ra6Z1cJ8RBzY= X-Received: by 2002:a9d:61cf:: with SMTP id h15mr14644424otk.344.1568495942522; Sat, 14 Sep 2019 14:19:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 14 Sep 2019 22:18:20 +0100 Message-ID: To: Kosit Supanyo Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="0000000000007c5c17059289ebea" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: oludonsexy@gmail.com (Olumide Samson) --0000000000007c5c17059289ebea Content-Type: text/plain; charset="UTF-8" https://jaxenter.com/php-tiobe-sept-2019-162096.html I think this is one of those things we get from voting no... I might be wrong anyways :-? On Sat, Sep 14, 2019, 12:43 AM Kosit Supanyo wrote: > Hi internals > > This maybe a little bit late but I would like to propose alternative to > this RFC. > > What if we add `strict_errors` declare to make every function/method in > files that declared `strict_errors` throw ErrorException on Notice/Warning. > > Example: > > File: Test.php > declare(strict_errors=1); // does not support block declare like > 'strict_type' > > class Test { > public function __construct() > { > echo $a; // ErrorException will be thrown from here > } > } > > File: main.php > require 'Test.php'; > $test = new Test(); // Fatal error: Uncaught ErrorException: Undefined > variable: a > > But if `set_error_handler()` is in use nothing will happen. > > File: main.php > require 'Test.php'; > set_error_handler(function () { > > }); > $test = new Test(); // silent > > I've just made a naive implementation to demonstrate this approach at > https://github.com/webdevxp/php-src. > What I've done was just adding new ZEND_ACC_STRICT_ERRORS flag to top level > function and modified `php_error_cb` to check if there is a caller with > `strict_errors` defined. (by simply checking `EG(current_execute_data)` and > its all `prev_execute_data`) > > I think this approach might satify both 'strict camp' and 'bc camp'. > > P.S. I myself agree with this RFC and would vote YES if I can vote. And I'm > grateful for Nikita's (and others) contributions that make PHP awesome > today. > > Cheers :) > > On Wed, Aug 28, 2019 at 4:33 PM Nikita Popov wrote: > > > Hi internals, > > > > I think it's time to take a look at our existing warnings & notices in > the > > engine, and think about whether their current classification is still > > appropriate. Error conditions like "undefined variable" only generating a > > notice is really quite mind-boggling. > > > > I've prepared an RFC with some suggested classifications, though there's > > room for bikeshedding here... > > > > https://wiki.php.net/rfc/engine_warnings > > > > Regards, > > Nikita > > > --0000000000007c5c17059289ebea--