Re: RFC: Catchable "call to a member function of a non-object"
| From: | Derick Rethans | Date: | Tue, 29 Apr 2014 08:26:34 +0000 |
| Subject: | Re: RFC: Catchable "call to a member function of a non-object" | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73840@lists.php.net to get a copy of this message | ||
On Sun, 27 Apr 2014, php@thekid.de wrote:
> Hello everyone,
>
> as per the RFC process I'd like to start a discussion on the RFC
> I've put up on the RFC Wiki:
>
> Â Ï
> §êÑ»ÂÖ¨&¾VÍ{jhttps://wiki.php.net/rfc/catchable-call-to-member-of-non-object
> Â RFC: Catchable "call to a member function of a non-object", 1.0
>
> The essence of this pull request is that it converts this fatal error
> into E_RECOVERABLE_ERRORs. Framework authors may choose to convert
> these into exceptions, as they already do with argument type mismatches.
>
> Feedback is welcome!
Besides the technical issues that Johannes already mentions, I am also
against this for logic reasons.
Calling methods on NULL objects is a programming mistake. You either
have a bug in the code that creates the objects, and in cases where it
is somethings OK to not have an object, you forgot to check whether you
have an objects. Programming mistakes should not be hidden by error
handlers.
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine