Hi,
The attached patch (against zend_execute.c 1.316.2.10) changes a "Call
to a member function on a non-object" from E_ERROR to E_WARNING so it
can be handled by a "user space" error handler.
Best regards,
Morten Poulsen
--
Morten Poulsen <morten+php@afdelingp.dk
The attached patch (against zend_execute.c 1.316.2.10) changes a "Call
to a member function on a non-object" fromE_ERRORtoE_WARNINGso it
can be handled by a "user space" error handler.
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.
Best regards,
Per Lundberg / Capio ApS
Phone: +46-18-4186040
Fax: +46-18-4186049
Web: http://www.nobolt.com
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.
I agree.
-Andrei
- I wish life had an UNDO function. *
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
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?
Calling a member function on a null should not even happen in production
environment, if you architecture your application properly.
-Andrei
"The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" but "That's funny..." -- Isaac Asimov.
Calling a member function on a null should not even happen in production
environment, if you architecture your application properly.
Correct. "Should not," but they do.
--
Morten Poulsen <morten+php@afdelingp.dk
Calling a member function on a null should not even happen in production
environment, if you architecture your application properly.Correct. "Should not," but they do.
We can not prevent everybody's mistakes. There are enough other ways to
shoot yourself in the knee.
Derick
--
"my other box is your windows PC"
Derick Rethans http://derickrethans.nl/
International PHP Magazine http://php-mag.net/
The attached patch (against zend_execute.c 1.316.2.10) changes a "Call
to a member function on a non-object" fromE_ERRORtoE_WARNINGso it
can be handled by a "user space" error handler.
It should fail, E_ERROR is just fine.
Derick
--
"my other box is your windows PC"
Derick Rethans http://derickrethans.nl/
International PHP Magazine http://php-mag.net/