Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90492 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21072 invoked from network); 11 Jan 2016 14:07:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2016 14:07:52 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:36722] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/48-64385-737B3965 for ; Mon, 11 Jan 2016 09:07:52 -0500 Received: by mail-wm0-f41.google.com with SMTP id l65so212577185wmf.1 for ; Mon, 11 Jan 2016 06:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=8FJL8SvTlhU1ymIkLJWWtvjlz+vgguZipENbf2LN/0k=; b=W72px+zv81nrvq1ZKjAzQJ05cfAvT/DNVRGljvRrEGIiJMQpPPdtDMoPz6CUDCrndJ ky4bdD3M9uOB1uAV1Wlcmn0TNE5HlABE2kfmz41HBtzh6qZGvKaJxyXwkeQQbR8sITyc JB7OCnPrTFCGDo8Yd4DCFeCyBES7kQXdlIDWDkIHciwBCnJZ3ISKknFmlEfS2ULi6uB2 JaLPfA/pjyRlCz9JJhVp5Yw8h4zznT6ahfXPbTXBheZjZaKWf5KawfFDe7OJ7du/klnx aWQF2ojAX/cMKejbKBCvV16jk8DDcXzguH2cOCHT/4iVIRxrHqFOm/NFkPCugRcV4HMT jcXQ== X-Received: by 10.28.126.84 with SMTP id z81mr14373532wmc.29.1452521268883; Mon, 11 Jan 2016 06:07:48 -0800 (PST) Received: from [192.168.0.141] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id jo6sm120021091wjb.48.2016.01.11.06.07.47 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jan 2016 06:07:48 -0800 (PST) To: internals@lists.php.net References: Message-ID: <5693B6BB.9020607@gmail.com> Date: Mon, 11 Jan 2016 14:05:47 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Throwable and Error exceptions break existing PHP 5.x code From: rowan.collins@gmail.com (Rowan Collins) Giovanni Giacobbi wrote on 11/01/2016 13:31: > set_exception_handler(callback function, bool also_throwables = false); > > The new parameter "also_throwables" defaults to false, so the same > behaviour as before is preserved. If you want it to catch also the new PHP7 > Error exceptions, you can just set it to true. This is an interesting idea, but other than the specific transition to PHP 7, I'm not sure when it would be used. Put it this way: if Errors existed when you first wrote this code, would you want to handle them using your custom handler functions, or would you prefer them to the fall through to the default server White Screen of Doom? My guess is that you'd want to pass them to the handler, even if it immediately checked "if ($e instanceOf Error)" and used a different output style. Since set_exception_handler() is intended as a last-ditch "something's gone very wrong" function anyway, I think it receiving all Throwables makes sense, even if the BC break in your scenario is unfortunate. Regards, -- Rowan Collins [IMSoP]