Re: [VOTE] RFC: Catchable "call to a member function of a non-object"
| From: | Yasuo Ohgaki | Date: | Sun, 27 Jul 2014 08:11:01 +0000 |
| Subject: | Re: [VOTE] RFC: Catchable "call to a member function of a non-object" | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76188@lists.php.net to get a copy of this message | ||
Hi Timm,
On Sun, Jun 29, 2014 at 7:40 PM, Timm Friebe <php@thekid.de> wrote:
> a couple of weeks ago, I proposed a change to the handling of the situation
> where methods are called on non-objects. Instead of an E_ERROR, the engine
> would
> raise an E_RECOVERABLE_ERROR, and enable framework and library authors to
> handle
> this.
>
> An intriguing usecase from my POV is to make use of this in tools like
> PHPUnit;
> instead of just printing a fatal error in the middle of a test run and
> exiting,
> the tools can decide to raise an exception and display the very much more
> helpful backtrace. No third-party PHP extensions needed for this, just a
> simple
> set_error_handler() call [1].
>
> I've verified various places like phpdbg and added a bunch of tests and am
> glad
> to extend that should anyone come up with a situation he/she feel this
> would
> behave in an unstable manner; athough this is realized in a somewhat
> similar
> manner to type hint mismatches, which have proven to be quite stable.
>
> Anyhow, I'd now like to see where we'd come out at and would kindly ask
> you to
> vote for or against inclusion of this feature:
>
>
> https://wiki.php.net/rfc/catchable-call-to-member-of-non-object#vote
>
> Thanks in advance!
>
I like the idea.
Only thing that I don't like is it depends on error message to be useful
rather than error code/status. Was this discussed? Just curious.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net