|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56905 Allow non-scalar constants to be defined and loaded
Submitted: 2006-03-21 09:08 UTC Modified: 2006-08-21 15:57 UTC
From: yonman at nsa dot co dot il Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: Irrelevant OS: Any
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.
Block user comment
Status: Assign to:
Bug Type:
From: yonman at nsa dot co dot il
New email:
PHP Version: OS:


 [2006-03-21 09:08 UTC] yonman at nsa dot co dot il
After integrating APC into my code I was surprised to find out that only scalar definitions can be stored and retrieved with APC's apc_load_constants and apc_define_constants.

If this limitation(?) can be lifted, it would allow the implementation of interesting i18n schemes and other templating solutions.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-21 09:44 UTC] gopalv82 at yahoo dot com
are you saying that you want constant arrays dumped into APC via this code path ?

There should be other more easier ways than going to all this trouble to cache it in shared mem.
 [2006-03-21 09:47 UTC] yonman at nsa dot co dot il
Well, seemed reasonable since this is already done in APC, but limited to scalars. I'm guessing this limitation is there to protect the programmer from doing exactly I want to do... but shouldn't I at least have a choice?
 [2006-08-21 15:57 UTC] gopalv82 at yahoo dot com
From the php manual: 

  You can define a constant by using the define()-function.
  Only scalar data (boolean, integer, float and string) can 
  be contained in constants.

There's no point, the language doesn't support non-scalar constants.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jun 06 03:03:42 2023 UTC