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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ajf at ajf dot me
New email:
PHP Version: OS:

 

 [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: Thu Apr 18 05:01:28 2024 UTC