Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61719 invoked from network); 3 Sep 2012 22:34:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 22:34:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:52833] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/DC-20751-58035405 for ; Mon, 03 Sep 2012 18:34:45 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 49DE87000449 for ; Mon, 3 Sep 2012 23:34:42 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id pAsiPU4hSd9t for ; Mon, 3 Sep 2012 23:34:42 +0100 (WEST) Received: from nebm.ist.utl.pt (unknown [IPv6:2001:690:2100:4::58:1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 099837000447 for ; Mon, 3 Sep 2012 23:34:41 +0100 (WEST) Received: from localhost ([127.0.0.1] helo=nebm.ist.utl.pt) by nebm.ist.utl.pt with esmtp (Exim 4.72) (envelope-from ) id 1T8fE9-0006Kr-TR for internals@lists.php.net; Mon, 03 Sep 2012 23:34:41 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 04 Sep 2012 00:34:41 +0200 To: Organization: =?UTF-8?Q?N=C3=BAcleo_de_Engenharia_Biom=C3=A9dica_do_Insti?= =?UTF-8?Q?tuto_Superior_T=C3=A9cnico?= In-Reply-To: <50452713.3020307@sugarcrm.com> References: <5040DC47.8000305@ajf.me> <5040F4D9.80206@sugarcrm.com> <5042946A.80204@sugarcrm.com> <5042A7D6.7050001@lerdorf.com> <50452713.3020307@sugarcrm.com> Message-ID: X-Sender: glopes@nebm.ist.utl.pt User-Agent: RoundCube Webmail/0.8-rc Subject: Re: [PHP-DEV] Re: Are exceptions allowed in php =?UTF-8?Q?core=3F?= From: glopes@nebm.ist.utl.pt (Gustavo Lopes) Em 2012-09-03 23:54, Stas Malyshev escreveu: > Hi! > >> indicating such mental model is widespread and (2) given that the >> exceptions you claim to be surprising don't happen but for a >> programming >> error (i.e. they're not exceptions that need to be caught). > > Following this logic, we'd have to convert all E_NOTICE and E_STRICT > to > fatal errors or exceptions - they are usually produced by programming > errors and aren't meant to be caught by surrounding code (actually, > can't). But I don't see anybody benefiting from this - as I don't see > anybody benefiting from generator that will explode your application > if > you touch it twice. > That does not follow at all. First, E_NOTICE exists to permit a compromise between people like Zeev that think its introduction was an error and that one should be able to refer to undefined variables and people who prefer a stricter model. For the programmers that follow this stricter model, an E_NOTICE ends ups frequently being a fatal (because, for instance, you invoke a method on the resulting null); some other times you're lucky and you just missed an "else $var = null" branch, other times the error is far more serious, like an unintended null -> 0 conversion. Second, E_STRICT exists to encourage good OOP practices. There is a lot of code that generates E_STRICT that does what it was intended to do (ask Lester). By definition, code that's not supposed to generate E_STRICT messages but does is buggy, but the fact that some code raises an E_STRICT does not signal, by itself, a bug. -- Gustavo Lopes