php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29021 Parse error caused by "valid" array/string syntax
Submitted: 2004-07-05 20:12 UTC Modified: 2004-07-06 09:12 UTC
From: johfivealive at hotmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0RC3 OS: Fedora Core 2
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: johfivealive at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-07-05 20:12 UTC] johfivealive at hotmail dot com
Description:
------------
I think this should not be a parse error, this should work. It seems the concatenation of LOGIK_CONFIG_FILE to the string:

"<span class=\"error\"><strong></strong> couldn't be opened for reading.<br />Check file permissions.</span>" 

is causing the parse error.

Reproduce code:
---------------
define( "LOGIK_DIRECTORY", $_SERVER['DOCUMENT_ROOT'] . "/" );
define( "LOGIK_CONFIG_DIRECTORY", "config/" );
define( "LOGIK_CONFIG_FILE", LOGIK_DIRECTORY . LOGIK_CONFIG_DIRECTORY . "logikconfig.xml" );
define( "LOGIK_CONFIG_FILE_FOPEN_ERROR", 3 );

static $errors = array(
                     LOGIK_CONFIG_FILE_FOPEN_ERROR => "<span class=\"error\"><strong>" . LOGIK_CONFIG_FILE . "</strong> couldn't be opened for reading.<br />Check file permissions.</span>"
                     );

The above array() creation syntax is what throws the parse error.

Expected result:
----------------
This shouldn't be a parse error because it is valid string concatenation syntax.

Actual result:
--------------
PHP reprts the following error:

Parse error: parse error, unexpected '.', expecting ')'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-06 09:12 UTC] derick@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

You can only have static array initializations, concatting to a string like you do is not supported.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 16:01:28 2024 UTC