Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66727 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19864 invoked from network); 20 Mar 2013 18:53:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2013 18:53:53 -0000 Authentication-Results: pb1.pair.com header.from=mjpelmear@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mjpelmear@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.43 as permitted sender) X-PHP-List-Original-Sender: mjpelmear@gmail.com X-Host-Fingerprint: 209.85.160.43 mail-pb0-f43.google.com Received: from [209.85.160.43] ([209.85.160.43:48921] helo=mail-pb0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/4C-46127-0C50A415 for ; Wed, 20 Mar 2013 13:53:53 -0500 Received: by mail-pb0-f43.google.com with SMTP id md12so1588478pbc.2 for ; Wed, 20 Mar 2013 11:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=mxtWSsQ8060cvEC2W/p/Az58azX6kOFXrDLx+HGIHsQ=; b=ct2i0oV0mC6yW2GPrzI/Iwf9wVLI0HthVGmtwa/WfThnkLSgs10PN44xKyaU7Sc6xb yar5ZKeRVXjCaSJ/UoW/FeCfkuJE5UW3tKyYlSw1qObsIrCmEkQJ3UGuMRin8jsug955 MD15ns0TROgeNZeh5+ShzjX2wtF1BF4jWme6SczyON75iEOLeoPJ82fM0G7xbT9Ol9QO 41R56m8c8hro7EILpLSu8ZGa2usyyEma7StEfoy7K+P5JjBstpYu9D9ZwnnNPkpZNUsD /1+fIfT3MUfqP+/tie4ckU/D+22YqFu40m3DLevpphBjcZwfTqSGWy223uknXkbrUfkT trFA== X-Received: by 10.66.160.225 with SMTP id xn1mr7022944pab.136.1363805630032; Wed, 20 Mar 2013 11:53:50 -0700 (PDT) Received: from [192.168.1.136] (cpe-76-175-163-99.socal.res.rr.com. [76.175.163.99]) by mx.google.com with ESMTPS id 1sm3009267pbg.18.2013.03.20.11.53.47 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Mar 2013 11:53:48 -0700 (PDT) Message-ID: <514A05BA.90409@gmail.com> Date: Wed, 20 Mar 2013 11:53:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Method check - Can someone create a RFC for it? From: mjpelmear@gmail.com (Matt Pelmear) On 03/20/2013 11:43 AM, Carlos Rodrigues wrote: > Like Mike emaild me, i can just change my code to something like > $obj->getImage()->getUrl(), where getImage() will return a mock object > with getUrl() returning an empty string. > > But my request here is not about this case only. > Imagine you have a web page with 3 blocks of information. Let's say > "news", "partners" and "blog". > > Now if for some reason you didn't code it right, you might get a fatal > error in one of these "blocks". > > I'd love to have a way to try/catch these blocks, Currently i can only > do this using ajax, or running shell exec "php block.php" for each > one. > > If we could catch fatal errors, or at least the "Call to a member > function on a non-object", we could have this code in our Zend > Framework implementations, wrapping each view in a try/catch, and > showing a "error, sorry", in case the view has errors. > > - Carlos > Carlos, You should take a look at the other thread that's been in the internals group over the last day or so. There is an effort to see cases like this become E_RECOVERABLE_ERRORs, which I think would address what you're really looking for. (In fact, this particular error is mentioned first in that thread.) But I would argue that, while this is a change I support, this is not a substitute for proper testing prior to code deployment (as others have pointed out). -Matt