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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 23:01:28 2024 UTC