Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113410 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18018 invoked from network); 6 Mar 2021 19:07:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Mar 2021 19:07:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 08CC51804E3 for ; Sat, 6 Mar 2021 10:59:04 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 6 Mar 2021 10:59:03 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id t5-20020a1c77050000b029010e62cea9deso1314342wmi.0 for ; Sat, 06 Mar 2021 10:59:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=2Tic3Jgphir9547K7M1nuUF8YRTLma0U7XxZjHmWuZo=; b=cjZ2RYt+hH0Tkf2vmJAoFVJ4/gnbfJMYRO3on0imY04WOPlqpCvRBUasfbtkPB+71I G9I6Gu9rccClrcLsY/DDE+fAf/SeFEc0oXJW8cNHN6kXsO6JAzwvgAgc2eVQ7BiAtS6h iLhsR25WppfhbK90iH+60wMuyAnB0wC6wftoBJdCtzg/SEzeaceLDgQiPnDOgEK00mBm eAM8XLTREOD/mEfaQ24UjNEtr1huGQ8mKjRbC+TcjtA054a0tPB4WWd5ACyJGeSolMQo dxsjQvmm7iOjRUlF5c3cM0R1hqdP5+aERyblpYwrJc8iUlLkLXSITLv5D7KzRrS6bgM8 wl/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=2Tic3Jgphir9547K7M1nuUF8YRTLma0U7XxZjHmWuZo=; b=Dd05YhhVvdUNoAZXGn9l8iHrwifgeEEyaUUop1QM8LYOuYb6zFYJufoY3sX+mNDLuT +3B0Z8ApkPHISvk6gd2yGSe7v/AgItH4oyIzWA8SJRBTD4WoqwuQnyyzqzZpXDd0SEHK dni7wip5U5GMmlBUUpM9a/r6nsgIrriHHabn4EO0o+vciprGr6lkaFLUOJwQ0ySj4bsj eD7jJ5K6/LTVleQOZN4OpQf/ZfeHUfon+2PMhawRJ+giBOwhFM0s6r6WQMtO81epHzIB 0mE4D84RVH8rpfO9xXYo6i/Ek2q/+CbtO7ki7ywgJHpf8sbmQi4qZU68hQzJvqxbiHQk 5llA== X-Gm-Message-State: AOAM530dLbUOUkruQrlNl7f0FalQnOdYTp7S3BAqECLf/Eh5iq3HOzKH rnRhmoB2A9ACPXgK0RQTgv2HppqYnjo= X-Google-Smtp-Source: ABdhPJypX7NLNiqzHJIz6SYNOXLaBxyk73amx58exgjmfGZrPr9c4c57u02AC/HrEOklp6ag/+HzAg== X-Received: by 2002:a1c:a985:: with SMTP id s127mr14307282wme.158.1615057140230; Sat, 06 Mar 2021 10:59:00 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id v6sm10203515wrx.32.2021.03.06.10.58.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Mar 2021 10:58:59 -0800 (PST) To: internals@lists.php.net References: <90cd28fd-f331-4f19-844b-4b03c2e7b0a8@www.fastmail.com> Message-ID: <69de00c3-826d-c00c-90bc-cf6760dc038f@gmail.com> Date: Sat, 6 Mar 2021 18:58:59 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <90cd28fd-f331-4f19-844b-4b03c2e7b0a8@www.fastmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Extend error control operator to suppress exceptions From: rowan.collins@gmail.com (Rowan Tommins) On 06/03/2021 18:00, Larry Garfield wrote: > My first thought is that if you're throwing away exceptions, you're therefore performing an expensive operation (generating a backtrace for the exception) that will then be discarded, and thus is wasted effort. I think regardless of any new syntax, this cost is something that needs to be looked into if we want to use exceptions for anything but the most extreme errors. If I'm catching a FileAccessDeniedException, the details of every framework function and middleware handler in my call stack probably aren't relevant, so being able to skip that overhead would be great. Would it be possible to build up the stack trace lazily, as the stack is unwound? Then if ->getTrace() is called, grab the rest of the stack, which will still be current anyway. In my head, it would look something like this, only at the engine level rather than an actual finally block: try {     ...     throw new Exception; // here, the current line number is captured, but nothing else     ... } finally {     // Save trace information for current frame before returning } Then further up the stack: try {    something_that_throws(); } catch ( Exception $e ) {    echo $e->getTraceAsString(); // trace is currently incomplete, but the remaining levels are the trace of the current line anyway, so we can put the cost here } Does that make any sense? Regards, -- Rowan Tommins [IMSoP]