php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42449 false positive on input error checking
Submitted: 2007-08-27 20:22 UTC Modified: 2007-08-27 20:55 UTC
From: f11n1 at unb dot ca Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.3 OS: Windows
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: f11n1 at unb dot ca
New email:
PHP Version: OS:

 

 [2007-08-27 20:22 UTC] f11n1 at unb dot ca
Description:
------------
I define a function that asks for a string with default set to null, then call it with non-null input, resulting in a PHP Catchable fatal error.

Reproduce code:
---------------
<?php
class output {
	public static function echo_params($p1 = "Hello World", string $p2 = null, bool $p3 = null) {
		// code that echoes the non-null parameters in a list
	}
}
echo output::func(null, "Hello World");
?>

Expected result:
----------------
p2 = Hello World

Actual result:
--------------
[Mon Aug 27 17:02:41 2007] [error] [client 127.0.0.1] PHP Catchable fatal error:  Argument 2 passed to output::echo_params() must be an instance of string, string given, called in F:\\Services\\Apache2\\htdocs\\index.php on line 8 and defined in F:\\Services\\Apache2\\htdocs\\index.php on line 4


(as a side note, really wanted): full, clean method overloading allowing declarations like "func(string a, string b)" alongside "func(string a, bool x, bool y)" and "func(string a, int z)"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-27 20:55 UTC] bjori@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

scalar type hinting are not supported (yet?).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 04 16:01:29 2025 UTC