php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46216 enhance const declaration
Submitted: 2008-10-02 08:51 UTC Modified: 2010-12-28 12:47 UTC
From: xigamy at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 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: xigamy at gmail dot com
New email:
PHP Version: OS:

 

 [2008-10-02 08:51 UTC] xigamy at gmail dot com
Description:
------------
I cannot declare a const a i would like to although i only use constant data.
imho a concatenation of constant strings should be possible. the same as any operation on only constant values should be allowed.
please? :-D

Reproduce code:
---------------
class SiteConfig {
  const HOST = 'www.test.com';
  const DOC_ROOT = '/sites/aa/2484356/htdocs/';
  const WEBMASTER_MAIL = 'webmaster@test.com';
  const DEBUG = false;
}

class AppConfig {
	const HOME = SiteConfig::DOC_ROOT.'inc/lib/app/';
}

Expected result:
----------------
AppConfig::HOME == '/sites/aa/2484356/htdocs/inc/lib/app/'

Actual result:
--------------
syntax error

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-28 12:47 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-28 12:47 UTC] jani@php.net
See bug #30177
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 19:00:03 2025 UTC