php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52311 PHP raises Fatal Error on not existent method invocation
Submitted: 2010-07-12 05:41 UTC Modified: 2010-07-13 18:41 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: d dot orlando dot 0 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.2 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: d dot orlando dot 0 at gmail dot com
New email:
PHP Version: OS:

 

 [2010-07-12 05:41 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-13 18:41 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2010-07-13 18:41 UTC] aharvey@php.net
This is by design, and can't be changed now without severely impacting backward compatibility. Errors in PHP code don't generally raise exceptions.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 05:01:33 2025 UTC