Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86049 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52674 invoked from network); 30 Apr 2015 00:26:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2015 00:26:23 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.48 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.48 mail-pa0-f48.google.com Received: from [209.85.220.48] ([209.85.220.48:36660] helo=mail-pa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/D4-29050-FA671455 for ; Wed, 29 Apr 2015 20:26:23 -0400 Received: by pabsx10 with SMTP id sx10so42608126pab.3 for ; Wed, 29 Apr 2015 17:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=f9r6Pie/3ANmw4aCDRlNFdgkKvQsmacev+Dw1M3tOgY=; b=eDj3Q66V62/JeihKR9bkealpxYPWbaQW6E3+Smjlt+J73OCDSQa0RMuhsVDIeNP59M IWrEKsj35E5rUz1RiofpKEu3nvmgbX7j4Xp3hLy6PHlQEsHJVvXC79Kq2RZDWlmMuh5B L7nYhe9dxy6DYEeRaNupuDBtJwJPCG7yMsQZREH5OsrcplM+hOEy970HFnohLuPHvCX1 hs93ghJLZMTKqzAm1bG7dvbGJTvYKeK0JLdslEolyZ25lP4NDZPNJT/TgXNGS8OZzD6w UTXC6pdiPR4lQdSj9VEu+fgMYTnkX+50d6c/E6LjjiBSJFlatNp2O+BXm2tpcwwXeoIy SKqA== X-Received: by 10.70.37.69 with SMTP id w5mr2963525pdj.123.1430353579606; Wed, 29 Apr 2015 17:26:19 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id gs7sm349202pbc.6.2015.04.29.17.26.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 17:26:18 -0700 (PDT) Message-ID: <55417693.5080909@gmail.com> Date: Wed, 29 Apr 2015 17:25:55 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Olivier Garcia , PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][VOTE] Improved Error Callback Mechanism From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > You can cast your vote on the Wiki [1] and the according patch is > available as a Pull Request [2]. > > Vote will be open for two weeks, counting from today. > I think the idea of this RFC is nice but it needs a bit more work to make it really good and successful. See some of the notes below and more technical ones in the patch. I think it would be good not to rush it but have it for 7.1 with more time to develop it to maturity. Reading the RFC, I'm not sure I fully understand what is the difference between E_HOOK_LOG, E_HOOK_DISPLAY and E_HOOK_PROCESS. The code just calls all of them in a sequence. What is the difference between them and when I use each of them? Especially not clear about E_HOOK_PROCESS - why I need it if I could just hook one of the other ones and do whatever I need to process the error? Also, there seems to be no link between E_HOOK_LOG and PG(log_errors) and E_HOOK_DISPLAY and PG(display_errors), so these will be called even if log/display globals set to disabled. So the code that implements something like custom error display would have to copy checks from PHP core code if they want the custom error not appear when display_errors is off (which they may want to I assume). If you override bailout callback and request bailout, then the bailout would happen, but nothing in zend_error_bailout_cb() would - i.e. no error code setting, no HTTP response code, etc. Also, zend_error_bailout_cb() actually calls zend_bailout(), so it is not clear - should the bailout hook call zend_bailout() or return FAILURE? The comment in the code of php_error_cb() says "hook_result == FAILURE means we must bail out" but the bailout does not actually happen there. Moreover, it is not clear when bailout hook is supposed to return FAILURE at all. Also, I see a lot of php_get_module_initialized() checks inside the specific handlers - but if an extension overrides it, these checks are not performed, so the extension may still work with uninitialized data, which would be not good. Of course, extension writer can copy-paste all these checks but it's easy to forget and if they ever change it would also be easy to forget to update it. -- Stas Malyshev smalyshev@gmail.com