From: f11n1 at unb dot ca
Operating system: Windows
PHP version: 5.2.3
PHP Bug Type: Reproducible crash
Bug description: false positive on input error checking
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 bug report at http://bugs.php.net/?id=42449&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42449&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42449&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42449&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42449&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42449&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42449&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42449&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42449&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42449&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42449&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42449&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42449&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42449&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42449&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42449&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42449&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42449&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42449&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42449&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42449&r=mysqlcfg