php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45105 Type Hinting cause Fatal error instead on NullPointorException
Submitted: 2008-05-27 08:56 UTC Modified: 2008-05-27 10:25 UTC
From: kingoleg at mail dot ru Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.6 OS: Irrelevant
Private report: No CVE-ID: None
 [2008-05-27 08:56 UTC] kingoleg at mail dot ru
Description:
------------
In same cases type hinting cause Fatal Error. I think that in one case NullPoinor will be better.

Reproduce code:
---------------
function foo(stdClass $a) {
}
foo(null);

Expected result:
----------------
Exception is thrown

Actual result:
--------------
Fatal error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-27 09:54 UTC] derick@php.net
There is no such thing as a NullPointer in PHP.
 [2008-05-27 10:25 UTC] kingoleg at mail dot ru
Yes, I know, but there is Exception.

Is it really need any fatal error if there are exceptions in PHP?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC