Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59147 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21949 invoked from network); 24 Mar 2012 13:26:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2012 13:26:41 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:36582] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/11-18105-09BCD6F4 for ; Sat, 24 Mar 2012 08:26:41 -0500 Received: by lahl5 with SMTP id l5so3146153lah.29 for ; Sat, 24 Mar 2012 06:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=O0Tc1nZA+nFkWyn17d5rnpAcgk80q6jBoLAZAxjaPTQ=; b=ipzDTSku0gWd85fwDTjMkKbodTJh4MnNkacjEiZa/ARm3BUfbzkTChBWFV3zHqxe5o Wu+A4Oxj4O97IO5g+LoO2KFN0kKWwhNWkWr+x61iF7/40I03QomoG+gTTW36Hdq5oHuF hd6aGFXDcbfnithYpgCrU315EyMPK7+1GYLMUbAyzoxpZD+GlcSXpsr08XZmpKMtzB3I sVB6H3A0yU8N3bAifSkQ6+C+zZxUpbz/a5FA6hlIocFTS45Db6b/pB0MPFSS9n5k9TB6 +LrgjdVTmB1f4aaCCqlrrV0AUw9HxDp88ySxsZ4J0c18OiYVtq2kYk2u6nxuX7HvZwLP gjlg== MIME-Version: 1.0 Received: by 10.112.38.68 with SMTP id e4mr5799184lbk.38.1332595597975; Sat, 24 Mar 2012 06:26:37 -0700 (PDT) Received: by 10.152.127.68 with HTTP; Sat, 24 Mar 2012 06:26:37 -0700 (PDT) Date: Sat, 24 Mar 2012 14:26:37 +0100 Message-ID: To: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: set_error_handler and set_exception_handler behavior From: nikita.ppv@googlemail.com (Nikita Popov) Hi internals! Laruence and myself yesterday tried to slightly modify the set_error_handler behavior, but the change which we considered trivial was not perceived as such by others. So we are taking this to the ML. Current state of things: * set_error_handler(callback) and set_exception_handler(callback) will return the previous error/exception handler * set_exception_handler(NULL) will reset the exception handler (i.e. use the default PHP exception handler again) and return bool(true) * set_error_handler(NULL) throws an invalid argument error => inconsistent What we wanted to do: Allow the error handler being reset using set_error_handler(NULL). To be consistent with set_exception_handler(NULL) this was supposed to return bool(true). What people objected to: * Stas: The bool(true) return value does not really make sense. Instead the previous error/exception handler should be returned, as always. * Pierre: One shouldn't be able to reset the error/exception handler like that in any case. This behavior should be removed and instead there should be additional reset_error_handler() and reset_exception_handler() functions (and also get_error_handler() and get_exception_handler() if I got that right.) What I would do: Add support for set_error_handler(NULL) and change the return value of set_error_handler(NULL)+set_exception_handler(NULL) to the previous handler (i.e. Stas option). I implemented this option in this PR: https://github.com/php/php-src/pull/20 So, what are your opinions on this? Nikita