From: da_bomb at hisplace dot net Operating system: WinXP Pro PHP version: 5CVS-2003-07-09 (dev) PHP Bug Type: Feature/Change Request Bug description: Passing objects as default function parameters
Description: ------------ Hey, I've shown a function I'm trying to write that is giving me an error because I can set an object as a default function parameter. I don't know if this is a bug, or it wasn't intended to be possible but I reckon it would be a good addition. I can't see a specific reason not to have this functionality unless it runs into some issues such as namespaces did. Thanks :) Reproduce code: --------------- public function PadLeft ( Int32 $var1, Char $var2 = new Char ( ' ' ) ) { // line 315 try { $this->Value = str_pad($this->Value, $var1->Value, $var2->ToString(), STR_PAD_LEFT); return( true ); } catch ( xException $ex ) { return( $ex->False ); } } Expected result: ---------------- I wasn't expecting to see the error anyway :p I'd like to have the result I'm looking for returned if possible. Actual result: -------------- Parse error: parse error, unexpected T_NEW in D:\www\root\objects\TMP2ct7ths5f1.php on line 315 -- Edit bug report at http://bugs.php.net/?id=24570&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24570&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24570&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24570&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24570&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24570&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24570&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24570&r=support Expected behavior: http://bugs.php.net/fix.php?id=24570&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24570&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24570&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24570&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24570&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24570&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24570&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24570&r=gnused