Re: [PATCH] make "Call to a member function on a non-object" non-fatal
| From: | Morten Poulsen | Date: | Fri, 23 May 2003 21:53:20 +0000 |
| Subject: | Re: [PATCH] make "Call to a member function on a non-object" non-fatal | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1951@lists.php.net to get a copy of this message | ||
On Fri, 2003-05-23 at 18:00, Per Lundberg wrote:
> I think this patch is bad. It distorts the control flow of a normal
> program. Calling member functions on a non-object is a serious error,
> so the only real option IMO is dying, or throwing an exception.
The patch might not be the right way to implement it. Calling a member
function on null happens from time to time, when programmers don't check
the return value of a library call. In a production environment it is
bad, not having the option to handle the error, therefore it is bad to
just die. Throwing an exception might be a nicer way, but isn't that
future?
Best regards,
Morten
--
Morten Poulsen <morten+php@afdelingp.dk>