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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 11:01:36 2025 UTC