ID: 33325 Updated by: [EMAIL PROTECTED] Reported By: jacob at jacobweber dot com -Status: Bogus +Status: Wont fix -Bug Type: Class/Object related +Bug Type: Feature/Change Request Operating System: All PHP Version: 5.0.4 New Comment:
This was discussed before and the conclusion was not to implement it. Please search internals archives for the discussion (this message can help probably: http://www.mail-archive.com/internals@lists.php.net/msg13629.html). Previous Comments: ------------------------------------------------------------------------ [2005-06-13 23:44:36] [EMAIL PROTECTED] 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 This is intended behaviour. ------------------------------------------------------------------------ [2005-06-13 19:17:22] jacob at jacobweber dot com Description: ------------ When using type-hinting in a function's arguments, PHP should allow a default value of NULL. Otherwise you have to manaully check the type with instanceof. This would make it more convenient, and more consistent with Java. Reproduce code: --------------- function f (MyClass $o = NULL) { echo "success"; } f(); Expected result: ---------------- success Actual result: -------------- PHP compiler error. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33325&edit=1