Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107607 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65586 invoked from network); 21 Oct 2019 18:17:20 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 21 Oct 2019 18:17:20 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 62C102D1F86 for ; Mon, 21 Oct 2019 09:03:01 -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-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 ; Mon, 21 Oct 2019 09:03:00 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id o16so4415579ilq.9 for ; Mon, 21 Oct 2019 09:03:00 -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; bh=ayyE2HXSPuHAQ4aYH9rmiwx8iua7JpPl/zSOVxBIZv4=; b=fePOA9VH28VzBy56Ayk698M9wMSwljRoaXHriDwmQDSJ7EpHzlz/SVInkd+PTb2tHQ yhbaVoqhdExrYLbiHTfPdO9S4NpFe2/dLtlAb4rlEGVbO2nYUElOV72S/vnkDosWGuQ1 oT7vugD9QPO3c6+hO+HvdWH23f3+74ozbp0tkDLeagY8AK961mS7FYxKNSedqofgFd0z sbhSbNfDn22QyUmeG+Z11wh39XPVcAbFaKckirqd8dZXkzl7W0pDIa/8l02ea7VH6HWA cAZ3TuKvl1X3loGqyE/V2thVi4g+3OsDXmbedeTbuHvwmD7UQ/yK/5X8dsNPE+0cAkZ0 C9iw== 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; bh=ayyE2HXSPuHAQ4aYH9rmiwx8iua7JpPl/zSOVxBIZv4=; b=or2ok58nJl2gJYwb4m0nSW+pU4wkvYF+MvclyvbLljJBR+PhKh7TNUlGmRBa+R5+YC LZE/3F34L7ehT7LL4aPzrOGJHlhsb86N2nTn0j7z2xvoiu9wPBvT1ZCr5tvr88XLt7oA XrLaqio+DvEdj+pfWgJBqOBRi6T9h/OTm8NfuOFEalyxrOBh6IICtVzeHDSeW3cTQ5nP JE/FIcaD7Gowwf2Cv9SQAtfMeRHteWrTeig9ftuDyOI6VQokYaWzA6dVZ638v0PbcBn8 T2bGPLmOHIzzCymv6QR4Sw7Q6e7CDu36GSEJt5A9yoa52IqucrLWgqwhZZqi7FQdyIoJ 0iGw== X-Gm-Message-State: APjAAAWV6LH2ep5tYRWtQXZGOTe2ge0dSrx4DIQAkUqe1Pgak7BIX+0W MmFXICb+5VV01Fwq/gbR5ltGBBZgjkKnIGi3CxNhNo58 X-Google-Smtp-Source: APXvYqxAKodIuDgThfd1vlFqeK0PteKFumHDmxofUCK325KIi0nbZVxNnoXOi7KJS7cYmH3IEX+g/WE/brDur/koZhI= X-Received: by 2002:a92:7303:: with SMTP id o3mr9762752ilc.120.1571673780030; Mon, 21 Oct 2019 09:03:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 21 Oct 2019 17:02:48 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000005c973405956dd140" X-Envelope-From: Subject: Re: [PHP-DEV] Reclassifying some PHP functions warning as exceptions From: rowan.collins@gmail.com (Rowan Tommins) --0000000000005c973405956dd140 Content-Type: text/plain; charset="UTF-8" Hi David, Firstly, I agree with Nikita's general rule of which Warnings should be promoted and which need deeper thought. I would like to challenge one assertion in your e-mail, which is related to that thought process: On Mon, 21 Oct 2019 at 14:52, David Negrier wrote: > We would be happy to promote more warnings to exceptions as those: > - are more predictable > - can be more easily caught / handled > I have always thought, and continue to think, that converting all Warnings (and Notices) to Exceptions is inappropriate, because Exceptions have some very specific behaviours, which are not always desirable: - They immediately jump control out of the current frame of execution. Unless you put a separate "try-catch" around every line, there is no "acknowledge and run next line". - Their default behaviour if not handled is to completely terminate whatever is happening, right up to showing a blank white screen. There is no general way to know whether the result of aborting execution completely is better or worse than carrying on with unexpected values. In a program that's not expecting it, either one could lead to data loss or corruption. There are definitely places where a Warning can reasonably be converted to an Exception; but I don't think this should be done as some kind of bulk change. Each Warning we promote should have at least one person answer the question "is it likely that terminating processing when this happens at run-time will be better than flagging a Warning and returning a defined value?" Regards, -- Rowan Tommins [IMSoP] --0000000000005c973405956dd140--