From: viraptor at sol dot wsiz dot rzeszow dot pl Operating system: Any PHP version: 5.0.1 PHP Bug Type: Feature/Change Request Bug description: Not constant default argument
Description: ------------ When started using php 5 I tried to do something like this: class A { private $var; function B($arg = $this->var) { ... } } Got 'unexpected T_VARIABLE' or course, but I think it would be a nice option to add in a future releases - default arguments computed when function is called. It could be especially useful when used inside classes. Probably the same as bug #6566, but if it disappeared after php3, it certainly should be turned on again in php5 Expected result: ---------------- Compute default arguments when calling a function, that can create those itself. It will help if you need something like: function A ($arg = NULL) { if($arg == NULL) $arg=$another_arg; ..... } -- Edit bug report at http://bugs.php.net/?id=29863&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29863&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29863&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29863&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=29863&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29863&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29863&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29863&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29863&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29863&r=support Expected behavior: http://bugs.php.net/fix.php?id=29863&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29863&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29863&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29863&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29863&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29863&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29863&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29863&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29863&r=float