News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DZone.com:
What you must know about PHP errors...
March 04, 2011 @ 13:15:06

Giorgio Sironi has a new post to the DZone.com Web Builder Zone today giving a high-level guide to some of the PHP errors you could encounter in your development time.

While pure object-oriented languages produces mainly exceptions to signal an error, PHP started out as procedural and so it has a wide range of errors that can be raised along with exceptions.

He talks about a few of the most common error related issues:

  • Exceptions
  • Errors
  • Error Types (E_NOTICE, E_PARSE, etc.)
  • php.ini directives
  • PHP functions for setting error handlers
0 comments voice your opinion now!
error exception phpini types errorhandler custom


Rob Allen's Blog:
Handling exceptions in a Front Controller plugin
December 20, 2010 @ 11:52:48

Rob Allen has another Zend Framework-themed post to his blog today looking at handling exceptions in front controllers a bit more correctly than they're currently treated.

If you have a Zend Framework Front Controller plugin which throws an exception, then the action is still executed and then the error action is then called, so that the displayed output shows two actions rendered, with two layouts also rendered. This is almost certainly not what you want or what you expected.

He points out the more correct process it should follow - dispatch the request and catch the error there before the request continues. The error is then tossed to the error controller for correct handling. He includes the code to do just that, showing how to wrap the routing in a try/catch and push the exception over to the error controller with an "error_handler" plugin created with an exception type of "other".

0 comments voice your opinion now!
exception frontcontroller zendframework errorhandler trycatch


Stefan Priebsch's Blog:
Turning errors into exceptions
April 30, 2008 @ 12:53:35

In a recent blog entry Stefan Priebsch shows how to take an error thrown by your script and turn it into an exception (to make things like catchable fatal errors).

While I would personally prefer an exception to be thrown in the first place, it is pretty easy to convert errors to exceptions in PHP.

His example is pretty simple - you set a custom error handler in your script that pulls in the error information and tosses an exception based on the error number the handler is given. Then you can use the try/catch method to see if your script has tossed an exception of the fatal error type. Nice simple solution to handle an interesting little problem.

0 comments voice your opinion now!
error exception convert try catch fatal errorhandler



Community Events





Don't see your event here?
Let us know!


community framework code series api laravel application threedevsandamaybe interview list language library podcast introduction wordpress install unittest configure release developer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework