php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52438 Parser error on a simple example
Submitted: 2010-07-25 16:02 UTC Modified: 2010-07-26 02:27 UTC
From: dagdamor10 at mail dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.14 OS: Windows
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: dagdamor10 at mail dot ru
New email:
PHP Version: OS:

 

 [2010-07-25 16:02 UTC] dagdamor10 at mail dot ru
Description:
------------
My framework (http://www.phpc.ru) uses automatic code generation, and when I was fine-tuning it, I discovered a weird error in the PHP parser.

Test script:
---------------
<?php

function test() {?>This is a test.<?php}

?>

Expected result:
----------------
Empty screen (since the function is never called)

Actual result:
--------------
Parse error: syntax error, unexpected $end in index.php on line 6


If you add a space character between "<?php" and "}", it works just fine.

I simply used a workaround, but maybe this report will be useful for you.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-26 02:27 UTC] scottmac@php.net
-Status: Open +Status: Bogus
 [2010-07-26 02:27 UTC] scottmac@php.net
It's always been <?php\w that has been required for lexer.
 [2010-07-26 10:21 UTC] dagdamor10 at mail dot ru
Since "}" is not a letter (and never was), the test above is perfectly valid.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 18:01:33 2025 UTC