php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63794 Parser does not match EOF after opening tag
Submitted: 2012-12-18 00:47 UTC Modified: 2012-12-18 03:40 UTC
From: simon at simon dot geek dot nz Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.5.0alpha1 OS: N/A
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: simon at simon dot geek dot nz
New email:
PHP Version: OS:

 

 [2012-12-18 00:47 UTC] simon at simon dot geek dot nz
Description:
------------
The parser for the opening tag checks for <?php[ \t\n]. This causes a file that's 
an opening tag, directly followed by the EOF to not be parsed as a PHP file, 
causing the tag to be outputted.

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

Expected result:
----------------
No output at all.

Actual result:
--------------
The <?php tag is outputted.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-18 00:49 UTC] simon at simon dot geek dot nz
Tested this on PHP 5.3.15, 5.4.9-dev and 5.5.0a1. The same behaviour occurs each 
time.
 [2012-12-18 02:44 UTC] laruence@php.net
I am not sure, why we need this?
 [2012-12-18 02:50 UTC] aharvey@php.net
Rasmus's comment in bug #61723 is probably relevant here.
 [2012-12-18 03:40 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-12-18 03:40 UTC] rasmus@php.net
Yeah, EOF is not classified as whitespace as per the spec, so <?php<EOF> is not 
actually a valid opening PI tag and as such it is correct that it will be output. 
No bug here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 23:01:33 2025 UTC