Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59148 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23464 invoked from network); 24 Mar 2012 13:32:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2012 13:32:52 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:43508] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/61-18105-30DCD6F4 for ; Sat, 24 Mar 2012 08:32:51 -0500 Received: by vcbfo14 with SMTP id fo14so4093728vcb.29 for ; Sat, 24 Mar 2012 06:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=krWqH5bCgL3IiSxPxg6fzP/iIqlLhNoQXphY0qvkEO0=; b=rboGqoDRLQganh0CL0r/6D1+dM4SSOtJxsrPG3P0EjbNnYHZAYyi5u24m92sgCtgqZ h50SMozfcdLFL7/77FP6ZzqW8lHqRiboaI5GqO/mgA4uyWAFz2dv+wB2jH8huhnERDH+ 7luYRk0T4lus0Qe1Cnv4/VmCQjQp2/2Y05GtqWRnfF+ZGU12IRLkYY/vSBCzC8Nnxh8a p4D5PIZsqpY9dch2lbCerd7IkqJn8bHFy1I+t1ZYT9Qm/gTvQdLh03Cf/6bUL7KQpUlN IjjcjMotIWzCiz+saokQVDt37uYRKXSCTDpyeLUCFsTtBfLLznbikR70oXn5kGsH4c1C 4J5A== Received: by 10.52.90.111 with SMTP id bv15mr6696888vdb.34.1332595968677; Sat, 24 Mar 2012 06:32:48 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.18.194 with HTTP; Sat, 24 Mar 2012 06:32:28 -0700 (PDT) In-Reply-To: References: Date: Sat, 24 Mar 2012 21:32:28 +0800 X-Google-Sender-Auth: ovm7FhAzw_7UJmY89aTJZw293z8 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] set_error_handler and set_exception_handler behavior From: laruence@php.net (Laruence) On Sat, Mar 24, 2012 at 9:26 PM, Nikita Popov w= rote: > 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: > =C2=A0* set_error_handler(callback) and set_exception_handler(callback) > will return the previous error/exception handler > =C2=A0* set_exception_handler(NULL) will reset the exception handler (i.e= . > use the default PHP exception handler again) and return bool(true) > =C2=A0* set_error_handler(NULL) throws an invalid argument error =3D> inc= onsistent > > 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: > =C2=A0* Stas: The bool(true) return value does not really make sense. > Instead the previous error/exception handler should be returned, as > always. > =C2=A0* Pierre: One shouldn't be able to reset the error/exception handle= r > 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: > =C2=A0Add 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? I was plan to explain why, but you described very well :) thanks > > Nikita > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/