News Feed
Sections




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

Miro Svrtan:
PHP Fatal errors into exceptions natively
August 28, 2012 @ 10:08:39

Miro Svrtan has a new post today proposing something that could be added to help handle bad method calls in PHP apps - using the BadMethodCallException (pre-existing) instead of throwing fatal errors.

Using getter method that is not implemented will get you fatal error saying how undefined method is called and request will stop. [...] On the other hand if you would use public property all you would get is a notice saying how this property does not exist and rest of request would be completed. [...] I know that this is due to dynamic typing behavior of PHP and no I am not suggesting raising a notice if undefined method gets called but since 5.1.0 there is a BadMethodCallException class which would be perfect for this situation.

There's been other people that have proposed the same idea as a bug, but nothing formal has been submitted as an RFC to make the change. Miro is looking for feedback to find if others would be interested in this feature and want to make the proposal (leave comments here).

0 comments voice your opinion now!
exception native badmethodcallexception fatal error rfc


blog comments powered by Disqus

Similar Posts

Mark Kimsal's Blog: Is Your MVC MIA When it Comes to 404s?

Rob Allen's Blog: SqlSrv v2 and long field names

Jani Hartikainen's Blog: How to use built-in SPL exception classes for better error handling

Ole Markus' Blog: Catching fatal errors in PHP

Jamie Wong's Blog: Effective bugfixing techniques for PHP


Community Events

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


podcast library community version example laravel interview security list voicesoftheelephpant framework language opinion introduction extension laravel5 series php7 release api

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