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).
I think changing the fatal error to E_RECOVERABLE_ERROR will be a good option, because if you have a generic error handler, then you won't have to worry about blank pages on a production server