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