#21849 [Opn->Ver]: self::constant doesn't work as method's default parameter
| From: | sebastian@php.net | Date: | Thu, 23 Jan 2003 22:52:40 +0000 |
| Subject: | #21849 [Opn->Ver]: self::constant doesn't work as method's default parameter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31092@lists.php.net to get a copy of this message | ||
ID: 21849
Updated by: sebastian@php.net
Reported By: sebastian@php.net
-Status: Open
+Status: Verified
Bug Type: Scripting Engine problem
Operating System: Windows 2000
PHP Version: 5CVS-2003-01-23 (dev)
Previous Comments:
------------------------------------------------------------------------
[2003-01-23 16:51:05] sebastian@php.net
<?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 this bug report at http://bugs.php.net/?id=21849&edit=1