Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69218 invoked by uid 1010); 19 Oct 2007 07:42:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69203 invoked from network); 19 Oct 2007 07:42:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Oct 2007 07:42:57 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 204.127.200.82 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 204.127.200.82 sccrmhc12.comcast.net NetCache Data OnTap 5.x Received: from [204.127.200.82] ([204.127.200.82:54033] helo=sccrmhc12.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/99-00686-10068174 for ; Fri, 19 Oct 2007 03:42:57 -0400 Received: from earth.ufp (c-71-228-13-89.hsd1.il.comcast.net[71.228.13.89]) by comcast.net (sccrmhc12) with ESMTP id <20071019074254012009n7v4e>; Fri, 19 Oct 2007 07:42:54 +0000 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id 880CDD829A for ; Fri, 19 Oct 2007 02:42:56 -0500 (CDT) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.ufp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id icuuouHzxwmc for ; Fri, 19 Oct 2007 02:42:55 -0500 (CDT) Received: from vulcan.ufp (vulcan.ufp [192.168.42.4]) by earth.ufp (Postfix) with ESMTP id E915ED7C6B for ; Fri, 19 Oct 2007 02:42:44 -0500 (CDT) To: internals@lists.php.net Date: Fri, 19 Oct 2007 02:42:38 -0500 User-Agent: KMail/1.9.6 References: <200710181920.33387.larry@garfieldtech.com> <50EC9DA1-0828-4800-8C6B-7A6E8876F42B@pooteeweet.org> In-Reply-To: <50EC9DA1-0828-4800-8C6B-7A6E8876F42B@pooteeweet.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200710190242.38287.larry@garfieldtech.com> Subject: Re: [PHP-DEV] exception policy for core From: larry@garfieldtech.com (Larry Garfield) On Friday 19 October 2007, Lukas Kahwe Smith wrote: > > I've actually had issues in the past with PDO and non-exception > > error-mode > > handling. I had queries that were running fine but when I checked > > the error > > value it gave a non-OK value. (I forget what off hand.) As soon as I > > switched to exceptions, it worked perfectly. I believe this was > > under 5.2.1. > > > > -- > > Well that sounds like a bug and not like a "feature" of exceptions. > Or are you implying that the added complexity of this switch makes it > harder to write bug free code. I do image that its a bit annoying to > have to write tests to cover all the error modes. > > regards, > Lukas I agree, although at the time I wasn't at the point where I could make a viable bug report out of it. I was writing a database wrapper layer around PDO (actually porting PDO into an existing wrapper), and did find in the end that exception-based checking, even though it never left the wrapping function I had around the actual query, made the code a lot nicer to deal with than an if-check in each case. The errors also made more sense, at least to me, than trying to get the error out of the returned error array with a variable number of entries in it. In any case, I don't find the exception usage of PDO to be a bad thing. I agree it should remain possible to use PHP without having dozens of try and catch blocks around everything, but remember that Exceptions are popular exactly because they are a clean and powerful mechanism. -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson