Re: Fatal error: Call to a member function on a non-object
| From: | Christopher Vogt | Date: | Mon, 17 Nov 2008 23:27:05 +0000 |
| Subject: | Re: Fatal error: Call to a member function on a non-object | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283409@lists.php.net to get a copy of this message | ||
Hej Jochem,
> this kind of thing belongs on php-general (and lets keep it on list
> please), if you have a serious proposal/rfc and/or one develops from a discussion
> there then likely some of the old-hats will likely recommend escalating to
> internal.
I'm sorry I wasn't aware of this "procedure". I will start discussions
on general@ from now on.
>> But the question remains. Are there reasons to have a Fatal error here?
>
> yes, it tells you your doing something impossible.
Well yes, but this does not mean it has to terminate. It could skip it
instead.
>> For comparison: Python throws an exception in a comparable case,
>> allowing me to handle the error.
>
> PHP != Python. python is pure OO. php is hybrid. you have to refactor your
> code in different ways.
Python is, just as PHP, a multi-paradigm language. Both support
procedural, OOP and even functional programming styles.
> what this comes down to is this, python gives you exceptions free of
> charge, php asks you to implement and throw them yourself ...
You are right. This seems to be, what it comes down too. I can't say
that I am happy with it. And I think being able to handle fatal errors,
whenever possible would be a very useful feature.
What about E_RECOVERABLE_ERROR, couldn't calling a method on a
non-object trigger E_RECOVERABLE_ERROR, instead of E_ERROR?
Best regards
Christopher