Req #46601 [Opn->Csd]: E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

From: Date: Tue, 07 Oct 2014 22:10:29 +0000
Subject: Req #46601 [Opn->Csd]: E_RECOVERABLE_ERROR for "Call to a member function on a non-object"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187923@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=46601&edit=1 ID: 46601 Updated by: thekid@php.net Reported by: bugs dot php dot net-V29nHf1_z-nsp at cvogt dot org Summary: E_RECOVERABLE_ERROR for "Call to a member function on a non-object" -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues PHP Version: 5.2.6 -Assigned To: +Assigned To: thekid Block user comment: N Private report: N New Comment: Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php https://wiki.php.net/rfc/catchable-call-to-member-of-non-object Fixed in PHP 7. Previous Comments: ------------------------------------------------------------------------ [2008-12-12 18:15:24] bugs dot php dot net dot nsp at cvogt dot org There is a workaround for handling fatal errors: http://ramchel.blogspot.com/2007/02/trapping-fatal-errors-in-php.html ------------------------------------------------------------------------ [2008-11-18 08:24:00] bugs dot php dot net-V29nHf1_z-nsp at cvogt dot org Description: ------------ Calling a method on a non-object results in a non catchable fatal error, that cannot be handled by an error_handler. It would be great if it would be a catchable fatal error instead. This would e.g. make possible to send an e-mail to the developers in case of such an error. When using object-orientation heavily, a program bug can easily result in an uninitialized or wrongly initialized variable, currently leading to a fatal error. Being able to handle this error case would be a great improvement for quality control. I hope the implementation of PHP allows such a change. This request is similar to http://bugs.php.net/bug.php?id=40587 . In case this request is rejected, please attach a short reason. Reproduce code: --------------- set_error_handler( create_function('$code','echo "error handler called ($code)\n";') ); $o = NULL; $o->method(); echo "end of script\n"; Expected result: ---------------- error handler called (4096) end of script Actual result: -------------- Fatal error: Call to a member function method() on a non-object ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=46601&edit=1

« previous php.bugs (#187923) next »