php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30007 NULL can't be send as argument if type_hinted
Submitted: 2004-09-07 12:28 UTC Modified: 2004-09-07 12:55 UTC
From: nightcat at poczta dot onet dot pl Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.1 OS: Linux
Private report: No CVE-ID: None
 [2004-09-07 12:28 UTC] nightcat at poczta dot onet dot pl
Description:
------------
PHP breaks OOB by not accepting null as a proper value for type_hinted argument.

In every OO language i know i have the way to dereference non-primitive object to null. Without this, i have to make _very_ big mess in code to make such things work.

Reproduce code:
---------------
class Foo {
}

function x(Foo $a, Foo $x) {
}

$l = new Foo();

x(null, $l);

Expected result:
----------------
normal work

Actual result:
--------------
Fatal error: Argument 1 must not be null in file.php in line 7

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-07 12:55 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This has been discussed before, it\'s not going to change in 5.0
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 17:00:02 2025 UTC