php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45683 Incorrect handling of XML processing instructions in included files
Submitted: 2008-08-01 22:11 UTC Modified: 2008-08-01 22:21 UTC
From: mephtu at yahoo dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.6 OS: linux
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: mephtu at yahoo dot com
New email:
PHP Version: OS:

 

 [2008-08-01 22:11 UTC] mephtu at yahoo dot com
Description:
------------
Using apache 2.0, I added a content handler for XML files so they get processed by a PHP script.  I want to include XML files into an output buffer but I get an "Unexpected T_STRING" parse error from the "<?xml version="1.0"?> processing instruction.  This is because PHP is, incorrectly, parsing all processing instructions as PHP code.

httpd.conf: 
...
AcceptPathInfo On
...

.htaccess:
...
Action process ./process.php
AddHandler process .xml
...

Reproduce code:
---------------
process.php:
<?php
ob_start();
include($_SERVER("PATH_TRANSLATED"));
ob_end_flush();
?>

content.xml:
<?xml version="1.0"?>
<tag>some data</tag>



Expected result:
----------------
I expect to see the following in "view source" in my browser:

<?xml version="1.0"?>
<tag>some data</tag>


Actual result:
--------------
PHP incorrectly attempts to parse the XML declaration at the beginning of content.xml giving an "Unexpected T_STRING, line 1, content.xml" error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-01 22:21 UTC] jani@php.net
Disable short_open_tag in your php.ini. No bug.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Sep 06 23:00:02 2025 UTC