Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110000 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37760 invoked from network); 5 May 2020 10:07:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 May 2020 10:07:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 393831804F3 for ; Tue, 5 May 2020 01:42:50 -0700 (PDT) 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.5 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 ; Tue, 5 May 2020 01:42:49 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id y3so1718060wrt.1 for ; Tue, 05 May 2020 01:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=Lnriaax8FmENTwpHEpuPlLCnE3ZFpzbsbTxjXMKvm3k=; b=itLbidOCtpQJsKDXNjY8OGU7cZ0mySA6UJC7Yh1hG6uKk00IhTl1VNhoTVCYkH30Yy u6lfKhrGcB5R/ynyglPAm7T/gxhwaX3SI/VJdqgqVJHoQ/wa94qSksz3Rxpjhe46RDHU LG+M4sFU6h4YqnvsuXK6Rgdxax4jNE3unpGytxZMAh813ARKUffVOskwTq1iQGtzLjLo l7MFrh0kgMHCGit+W69Fuc2Ml34VlyDBa4191Ay54Yrf5+Z4WE1kNKeP/XmN8AzZj+0F VKXpKxYWfaFkRzHiG1tPRORISFjaYTwiAhq4M14WZWjvx992uIe2L2ZDZAyo3tEN2Gx7 xGrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Lnriaax8FmENTwpHEpuPlLCnE3ZFpzbsbTxjXMKvm3k=; b=JXnnxWfM44C63inaH072bVWNanp6cUWCjHh+9/hveLkBLYRiGVOWurHxo5cd70bf1M oGZim+M2shH0k3oKPCgFRihcXtd2fxVWOzWMxsq3TkKuJUdvDlhL8WEEm9OvXXMPoJuI aJ66k+MxW/L1lwGI9e9T1x8dumSCmn9bZ3XKLnY6Iy++VFDlvXV2gx2NQE7OEOrlnESy o0lfKoffpjGv2ofEuAepWiIgTNMyDmQGKDXCjOUv2sceFwi4GmnMGynMyFPPsXh47yb9 q8nBZh3QGu9nx7IdPIe1/XcPZvxzdHVtmh8fWpITddnPoXNV7gyYJOV2+n0vo5iXVQTU DVhw== X-Gm-Message-State: AGi0PuZAFHE5+O0IzeZA8lAuPCmKBroLSOte1G5VjaReMCQKNZU88b5t hcLa2j6MMk9AhZ9cgJcSAjMxMgu8Dl0YLUL+dnwAC1Q8mWo= X-Google-Smtp-Source: APiQypLvlvUtRAE7zDR5cHVtaMveNqrJ9LSSKOUnQaLdIni6iaJwgzTK5YB20Ir3M378dA3636NnKwpGmM5BGhj8N3M= X-Received: by 2002:adf:ed82:: with SMTP id c2mr2588038wro.255.1588668167385; Tue, 05 May 2020 01:42:47 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 5 May 2020 10:42:36 +0200 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000c8859105a4e2a166" Subject: Breaking up php_error_cb/zend_error_cb to improve API for extensions From: kontakt@beberlei.de (Benjamin Eberlei) --000000000000c8859105a4e2a166 Content-Type: text/plain; charset="UTF-8" Heyo, I am experimenting with changes to break up the central error handling code into better manageable pieces for a while now. The idea was already voted positively upon in this RFC https://wiki.php.net/rfc/improved_error_callback_mechanism by Patrick five years ago, but it was never implemented at the time. The end goal should be that no extension should have to overwrite zend_error_cb anymore, as this is causing heavy side effects between many extensions. Specifically these three things are causing problems for everyone involved: - soap_error_cb hijacking zend_error_cb for rendering errors in SOAP fault xml - xdebug not being able to call the original handler - userland error handlers returning something else than false, which will skip calls to zend_error_cb entirely I propose the following things: 1. Provide extensions with a reliable observer API that always gets called, regardless of error_reporting, display_errors, log_errors, or userland error callback return value. This fixes problems of many extensions that interact with the zend_error_cb and interfere with each other (SOAP, Xdebug, all APM vendors). This API will be triggered **before** php_error_cb (zend_error_cb) are invoked. Direct benefit here is that it can also decouple DTrace from zend.c and some old "report_zend_debug" feature that looks both ancient and entirely unused. PR: https://github.com/php/php-src/pull/4555 2. Extract the display logic out of php_error_cb into a pluggable API. The list of display handlers is iterated and called, until one of the handlers returns 1 (meaning handled), while others that don't/can't display the error return 0. This has the goal of allowing extensions to modify how errors are rendered (Xdebug, SOAP need this). PR: https://github.com/php/php-src/pull/5484 I started to use this getting rid of soap_error_cb, but the bailout based exception handling is causing me some headaches. Should be solvable. 3. Extract the logging logic out of php_error_cb / php_log_err_with_severity into a pluggable API: This could allow extensions to provide additional logging targets. (No PR yet) Imho these changes are covered by the existing RFC. But they are going about it a bit differently than described. Should I Re-RFC these changes? Otherwise I would go ahead and find a few reviewers for each of them and merge the changes individually. greetings Benjamin --000000000000c8859105a4e2a166--