php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21849 self::constant doesn't work as method's default parameter
Submitted: 2003-01-23 16:51 UTC Modified: 2003-02-10 03:46 UTC
From: sebastian@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-01-23 (dev) OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sebastian@php.net
New email:
PHP Version: OS:

 

 [2003-01-23 16:51 UTC] 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".

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-09 09:57 UTC] moriyoshi@php.net
Related to bug #18926

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 04:01:35 2025 UTC