Bug #69841 [NEW]: Feature: Catchable "call to a member function of a non-object" is not working
| From: | davelhs03 at yahoo dot com | Date: | Mon, 15 Jun 2015 16:41:58 +0000 |
| Subject: | Bug #69841 [NEW]: Feature: Catchable "call to a member function of a non-object" is not working | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-193517@lists.php.net to get a copy of this message | ||
From: davelhs03 at yahoo dot com
Operating system: Windows 7
PHP version: 7.0.0alpha1
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Feature: Catchable "call to a member function of a non-object" is not
working
Description:
------------
In the RFC
(https://wiki.php.net/rfc/catchable-call-to-member-of-non-object)
set_error_handler was suppose to catch calls to methods on a non-object.
I'm not experiencing that when I use PHP7 Alpha1
(http://windows.php.net/downloads/qa/php-7.0.0alpha1-nts-Win32-VC14-x86.zip)
on Windows 7. I tried it on the command line and via the built in web
server. I can catch the exception if I do a try and catch
(EngineException $e) block, but not with the error handler.
//This Works:
$x= null;
try{
var_dump($x->method());
}
catch (EngineException $e)
{
echo 'caught the exception';
}
Test script:
---------------
set_error_handler(function($code, $message) {
var_dump($code, $message);
});
$x= null;
var_dump($x->method());
echo "Alive\n";
Expected result:
----------------
int(4096)
string(50) "Call to a member function method() on a non-object"
NULL
Alive
Actual result:
--------------
Fatal error: Uncaught EngineException: Call to a member function
method() on nul
l in C:\PHP7\scripts\test.php:6
Stack trace:
#0 {main}
thrown in C:\PHP7\scripts\test.php on line 6
--
Edit bug report at https://bugs.php.net/bug.php?id=69841&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69841&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69841&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69841&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69841&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69841&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69841&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69841&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69841&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69841&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69841&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69841&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69841&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69841&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69841&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69841&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69841&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69841&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69841&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69841&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69841&r=mysqlcfg