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
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: kingoleg at mail dot ru
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2026 The PHP Group
All rights reserved.
Last updated: Thu Jun 18 21:00:01 2026 UTC