Bug #52311 [Opn->Bgs]: PHP raises Fatal Error on not existent method invocation
| From: | aharvey@php.net | Date: | Tue, 13 Jul 2010 16:41:13 +0000 |
| Subject: | Bug #52311 [Opn->Bgs]: PHP raises Fatal Error on not existent method invocation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152372@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52311&edit=1
ID: 52311
Updated by: aharvey@php.net
Reported by: d dot orlando dot 0 at gmail dot com
Summary: PHP raises Fatal Error on not existent method
invocation
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: Any
PHP Version: 5.3.2
New Comment:
This is by design, and can't be changed now without severely impacting
backward compatibility. Errors in PHP code don't generally raise
exceptions.
Previous Comments:
------------------------------------------------------------------------
[2010-07-12 05:41:27] d dot orlando dot 0 at gmail dot com
Description:
------------
Invoking a method that doesn't exist raises a Fatal Error, and there is
no way to
catch the exception.
Test script:
---------------
<?php
class A
{
public function __construct()
{
\error_reporting(\E_ALL);
\ini_set('display_errors', true);
\ini_set('display_startup_errors', true);
try { $this->_init(); } catch (\Exception $e) {echo
"Catched!";}
}
}
new A();
Expected result:
----------------
Catched!
Actual result:
--------------
Fatal error: Call to undefined method A::_init() in
/srv/http/PHP/3/fatalerror.php on line 11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52311&edit=1