#42449 [Opn->Bgs]: false positive on input error checking

From: Date: Mon, 27 Aug 2007 20:55:04 +0000
Subject: #42449 [Opn->Bgs]: false positive on input error checking
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116735@lists.php.net to get a copy of this message
ID: 42449 Updated by: bjori@php.net Reported By: f11n1 at unb dot ca -Status: Open +Status: Bogus Bug Type: Reproducible crash Operating System: Windows PHP Version: 5.2.3 New Comment: 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?). Previous Comments: ------------------------------------------------------------------------ [2007-08-27 20:22:31] 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)" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42449&edit=1

« previous php.bugs (#116735) next »