From: baldurien at bbnwn dot eu Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Typehinting support null value but the docs hide the facts!
Description: ------------ The documentation is missing the fact that the following statement is possible : function o1(Foo $arg0 = null, $x) {} function o2(Foo& $arg0 = null, $x) {} The code above works on 5.2.3 (which is fine). The fact that a typehinted parameter can have a default (enforced to null) value should be explained at least in the type hinting part of the doc [http://ch2.php.net/manual/en/language.oop5.typehinting], with the version of php that support it (I can't remember it it was working on 5.1). Note also that the syntax can be misleading: one can easily think that $arg0 take a default value, and that o1('a') is possible (or o1(,'a')?). -- Edit bug report at http://bugs.php.net/?id=41958&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41958&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41958&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41958&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41958&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41958&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41958&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41958&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41958&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41958&r=support Expected behavior: http://bugs.php.net/fix.php?id=41958&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41958&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41958&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41958&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41958&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41958&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41958&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41958&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41958&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41958&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41958&r=mysqlcfg