php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43165 Static in assignment
Submitted: 2007-10-31 16:54 UTC Modified: 2007-10-31 20:01 UTC
From: felipensp at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-10-31 (snap) OS: Linux
Private report: No CVE-ID: None
 [2007-10-31 16:54 UTC] felipensp at gmail dot com
Description:
------------
PHP accepts keyword 'static' in assignment.

Reproduce code:
---------------
<?php

class foo {
  static $a = 1;
  public function __construct() {
    $a = static ::$a;
    var_dump($a);
  }
}

new foo;


Expected result:
----------------
Parse error: syntax error, unexpected T_STATIC

Actual result:
--------------
No error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-31 20:01 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That's the new late static binding feature, see http://docs.php.net/manual/en/language.oop5.late-static-bindings.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 04 12:00:02 2025 UTC