Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62604 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15005 invoked from network); 31 Aug 2012 12:47:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Aug 2012 12:47:09 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:64982] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/F0-09246-B42B0405 for ; Fri, 31 Aug 2012 08:47:08 -0400 Received: by pbbrp8 with SMTP id rp8so4641771pbb.29 for ; Fri, 31 Aug 2012 05:47:05 -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:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=HrFfhUE9lheP4gvXxgsY6wINRBjJuhs1wdDHeinvI4w=; b=uvxt5fXtxFFwLmaP/BFJFbCgSkagau5y9CTQcBp9I42iH1jCPCCsm6R5NaQAVv+XSh E+P3snyQJWUsYt3AAO3yRtpdsSlpqDJYtUtT5sBdM26tEwRcx7zhts4Kr6gSaA0qUioh djUY64xfJsUH6SD2vmCnZbe2uv5zcrnHfBq7OYxbAELuPOcD8BlylI7T96SF//kTVQn6 +HbN59MO3uLZiIpb+LfjvhFEqdXiDTsfbVRWjgcj2lSRp62Eln0y0kUxkIpB4Y5nU8r8 mnBK7kVwEC8mRuNgx5eLQzMHCqM9tY+trLKjDDMm+X8XVxdAJJytpjYoL4V/SUTVXZhE p6Bg== MIME-Version: 1.0 Received: by 10.66.89.70 with SMTP id bm6mr15116462pab.41.1346417224969; Fri, 31 Aug 2012 05:47:04 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.68.211.37 with HTTP; Fri, 31 Aug 2012 05:47:04 -0700 (PDT) In-Reply-To: References: Date: Fri, 31 Aug 2012 14:47:04 +0200 X-Google-Sender-Auth: wnkJt3gcU6l0LQotef0DxFHIP_4 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=f46d042ef4dd69ebef04c88f3080 Subject: Re: Are exceptions allowed in php core? From: info@tyrael.hu (Ferenc Kovacs) --f46d042ef4dd69ebef04c88f3080 Content-Type: text/plain; charset=UTF-8 On Thu, Feb 24, 2011 at 10:29 AM, Ferenc Kovacs wrote: > Hi. > > it was mentioned multiple times on the list, that exceptions from php core > is prohibited. > do we have some documentation about this? > the more detailed email on this topic was from Lukas: > http://www.mail-archive.com/internals@lists.php.net/msg43237.html > > > "Generally we have decided to leave Exceptions out of core with a few > "exceptions": > > 1) errors in the constructor will throw an exception > 2) extensions may choose to offer an Exception mode (see PDO) > > I never understood why we did 1), if a constructor can fail, then a > factory should be used instead. But oh well. With 2) you are obviously also > opening a pandoras box, that is similar to using a global error handler > that turns all Notices, Warnings etc as Exception: you can easily break > code that calls various libraries .. take for example passing in a PDO > instance to one library which expects the normal error mode and another one > that enables the Exception mode. For the most part however we can conclude > that most libraries enable the Exception mode in PDO and I think you will > be hard pressed to find any PDO code example that doesn't assume that the > Exception mode is enabled. " > > every other mention about this topic is in-general prohibits the usage of > exceptions. > http://www.mail-archive.com/internals@lists.php.net/msg49637.html > http://www.mail-archive.com/internals@lists.php.net/msg44159.html > > so I would like to know, that what is the current situation, and do these > mails still holds true. > maybe things has changed. > > Tyrael > Sorry for bringing up this thread, but based on the recent mails from Derick it seems to me that there is/was some agreement that core features shouldn't throw exceptions. http://www.mail-archive.com/internals@lists.php.net/msg60631.html http://www.mail-archive.com/internals@lists.php.net/msg60635.html It was also mentioned in that thread that we already have a bunch of exceptions in spl, and some of the spl features should be in the core (or it is already in the core for example IteratorAggregate). Personally I think that OOP features should be allowed to throw Exceptions, and I think that it would still in line with the our users expectations. The only problem that I can think of is that for some stuff, we have both a procedural and an oop API, but I'm not proposing turning everything into Exceptions, but using them where appropriate. --f46d042ef4dd69ebef04c88f3080--