|  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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: zolv at t-k dot pl
New email:
PHP Version: OS:


 [2007-07-10 10:04 UTC] zolv at t-k dot pl
    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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-10 10:22 UTC]
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-2021 The PHP Group
All rights reserved.
Last updated: Fri Feb 26 18:01:25 2021 UTC