#21849 [NEW]: self::constant doesn't work as method's default parameter
| From: | sebastian@php.net | Date: | Thu, 23 Jan 2003 22:51:05 +0000 |
| Subject: | #21849 [NEW]: self::constant doesn't work as method's default parameter | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-31091@lists.php.net to get a copy of this message | ||
From: sebastian@php.net
Operating system: Windows 2000
PHP version: 5CVS-2003-01-23 (dev)
PHP Bug Type: Scripting Engine problem
Bug description: self::constant doesn't work as method's default parameter
<?php
class Foo {
const Bar = 'Foobar';
function foobar($foobar = Foo::Bar) {
echo $foobar;
}
}
$o = new Foo;
$o->foobar();
?>
works, but
<?php
class Foo {
const Bar = 'Foobar';
function foobar($foobar = self::Bar) {
echo $foobar;
}
}
$o = new Foo;
$o->foobar();
?>
does not and prints "Fatal error: Undefined class 'self' in c:\test.php on
line 5".
--
Edit bug report at http://bugs.php.net/?id=21849&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21849&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21849&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21849&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21849&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21849&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21849&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21849&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21849&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21849&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21849&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21849&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21849&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21849&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21849&r=gnused