php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27022 Class constant has no visibility modificator
Submitted: 2004-01-23 12:47 UTC Modified: 2015-12-23 19:55 UTC
Votes:27
Avg. Score:4.6 ± 0.6
Reproduced:25 of 25 (100.0%)
Same Version:3 (12.0%)
Same OS:16 (64.0%)
From: andrey@php.net Assigned: seander (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0 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: andrey@php.net
New email:
PHP Version: OS:

 

 [2004-01-23 12:47 UTC] andrey@php.net
Description:
------------
It is not possible to use visibility modificator like public/protected/private on a class constant.

Reproduce code:
---------------
php -r "class fubar { protected const some_const = 123; }"

Actual result:
--------------
PHP Parse error:  parse error, unexpected T_CONST, expecting T_VARIABLE in Command line code on line 1

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-21 19:38 UTC] johannes@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2011-09-15 09:01 UTC] pulzarraider at gmail dot com
It would be great if php will have private/protected constants inside classes. It's very important feature for every real object programming language. If it would be available, the status of PHP, as a programming language, will grow.
 [2015-01-08 22:40 UTC] ajf@php.net
-PHP Version: 5CVS-2004-01-23 (dev) +PHP Version: 7.0
 [2015-01-08 22:40 UTC] ajf@php.net
This looks reasonable, bumping version.
 [2015-08-19 19:14 UTC] sean at siobud dot com
This seems to be a dupe of https://bugs.php.net/bug.php?id=69980

I started working on this, and will open a PR against php-src in the next couple of days. I don't intended on it getting merged anytime soon, but it is fun to work on.
 [2015-12-23 19:55 UTC] seander@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: seander
 [2015-12-23 19:55 UTC] seander@php.net
This was merged and available in master, the first release that will have it is (7.1)

thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 13:01:27 2024 UTC