php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18045 Parse error: parse error, unexpected ':', expecting '}'
Submitted: 2002-06-28 10:28 UTC Modified: 2002-06-28 11:04 UTC
From: webmaster at phpindex dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
 [2002-06-28 10:28 UTC] webmaster at phpindex dot com
This simple script crash with

Parse error: parse error, unexpected ':', expecting '}' in /usr/local/apache/htdocs/armel/crash.php on line 5

<?php
$foo = "php";
print "{$foo}";
print "{:$foo}";
print "{$foo:}";
?>

Note that if you comment the last print, it just return

php{:php}

and not

{php}{:php}

May be a small problem in the Zend Engine (see T_CURLY_OPEN) :

line 695  -> Zend/zend_language_parser.y
line 1348 -> Zend/zend_language_scanner.l

This bug is reproducible and have been tested with php 4.2.1 (apxs) and 4.2.0 (CGI).

Regards,

Armel.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-28 11:04 UTC] sander@php.net
This is not a bug but expected behaviour. ${ and {$ begin a variable name, and : is not allowed in a variable name. 
Not a bug -> bogus.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 23:00:01 2026 UTC