php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41948 Cant catch "PHP Catchable fatal error ... must be an instance of ..."
Submitted: 2007-07-10 10:04 UTC Modified: 2007-07-10 10:37 UTC
From: zolv at t-k dot pl Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.2 OS: x86_64-2.6.19-gentoo-r4
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zolv at t-k dot pl
New email:
PHP Version: OS:

 

 [2007-07-10 10:04 UTC] zolv at t-k dot pl
Description:
------------
    catch ( Exception $e) {
doesnt catch fatal error exception: 

PHP Catchable fatal error:  Argument 1 passed to AaaCollection::setAaa() must be an instance of Aaa, instance of Bbb given



Reproduce code:
---------------
<?

class Aaa { }

class Bbb { }

class AaaCollection {
    public function setAaa( Aaa $aaa  ) { }
}


$bbb    = new Bbb();
$aaaCol = new AaaCollection();

try {
    $aaaCol->setAaa( $bbb );
} catch ( Exception $e) {
    echo 'Exception has been catched';
}

Expected result:
----------------
exception should be catched


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-10 10:22 UTC] jani@php.net
Of course not, it's not an exception but just plain and simple error.
 [2007-07-10 10:37 UTC] zolv at t-k dot pl
thx for quick reply.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC