php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35697 Error while using a defined constant in a concat string
Submitted: 2005-12-16 04:34 UTC Modified: 2005-12-16 05:31 UTC
From: bryan at phpandmore dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.1 OS: Red Hat
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: bryan at phpandmore dot com
New email:
PHP Version: OS:

 

 [2005-12-16 04:34 UTC] bryan at phpandmore dot com
Description:
------------
I am defining a constant named SITE_ROOT, and it contains the value "/homepages/29/d113403321/htdocs". When I try to use it in Smarty.class.php, on line 75 or the latest stable version 2.6.11, and I get this parse error. I changed the coding for the class variables so that they would not issue a notice b/c of using var rather than public:

Parse error: parse error, unexpected '.', expecting ',' or ';' in /homepages/29/d113403321/htdocs/dev/smarty/Smarty.class.php on line 75


Reproduce code:
---------------
define("SITE_ROOT", '/homepages/29/d113403321/htdocs');
public $template_dir = SITE_ROOT2 . '/dev/smarty/templates';



Expected result:
----------------
$template_dir having a value of /homepages/29/d113403321/htdocs/dev/smarty/templates

Actual result:
--------------
parse error

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-16 04:51 UTC] bryan at phpandmore dot com
This is used inside a class definition.
 [2005-12-16 04:52 UTC] bryan at phpandmore dot com
It works when it is used outside of a class definition.
 [2005-12-16 05:31 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Default values for class properties must be literals.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 13:01:32 2025 UTC