|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67766 Inaccuracies in Program Structure
Submitted: 2014-08-05 16:15 UTC Modified: 2015-06-28 20:59 UTC
From: joelm at fb dot com Assigned: stas (profile)
Status: Closed Package: PHP Language Specification
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2014-08-05 16:15 UTC] joelm at fb dot com

The "<?php" open tag doesn't have to be at the top of the file, it can come later, and technically a PHP file might not have any tags at all. Also, after the "?>" close tag there can be more stuff and possible another open tag "<?php". Finally, there are some interesting things like how "<?" (with the "php" part) work as an open tag, and how "<script language='php'>" can also work as an open tag. Stuff that appears before the first open tag and stuff that appears after a close tag but before the next open tag is treated as content that is echo'd out when the flow of execution reaches it. 

Some of this has been addressed by changing the grammar for the syntactic grammar production “program”.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-05 16:30 UTC]
-Type: Documentation Problem +Type: Bug
 [2015-06-28 20:59 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2015-06-28 20:59 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

This seems to be already fixed.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 05:01:30 2024 UTC