php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69018 Constants supported for A::A but not A::{'A'}
Submitted: 2015-02-09 16:17 UTC Modified: 2015-02-09 16:44 UTC
From: ajf at ajf dot me Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.6.5 OS:
Private report: No CVE-ID: None
 [2015-02-09 16:17 UTC] ajf at ajf dot me
Description:
------------
Compare:

http://3v4l.org/t6RG1

http://3v4l.org/6nmGV

Test script:
---------------
<?php

Class A { const A = ['a']; }

var_dump(A::{'A'});

Expected result:
----------------
Fatal error: Arrays are not allowed in class constants in %s on line %d

Actual result:
--------------
Fatal error: Arrays are not allowed in class constants in /in/t6RG1 on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-09 16:17 UTC] ajf at ajf dot me
Er, the expected result was supposed to be this:

array(1) {
 [0]=> string(1) "a"
}

Sorry about that.
 [2015-02-09 16:43 UTC] ajf at ajf dot me
...actually, I'm not sure A::{'A'} was ever valid syntax. I make mistakes, ignore me.
 [2015-02-09 16:44 UTC] ajf@php.net
-Status: Open +Status: Not a bug
 [2015-02-09 16:44 UTC] ajf@php.net
Closing as "not a bug" since A::{'B'} was never supported, my bad.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 20:01:29 2024 UTC