|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-27 20:55 UTC] bjori@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
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)"