php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17971 Commenting out xml declaration with // causes parse error
Submitted: 2002-06-25 09:51 UTC Modified: 2002-06-25 10:28 UTC
From: martin at classaxe dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Windows 95/98 4.10 Apache 1.3.24
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: martin at classaxe dot com
New email:
PHP Version: OS:

 

 [2002-06-25 09:51 UTC] martin at classaxe dot com
Code Fragment:
<?php
  header("Content-Type: text/xml");
  print(""
    ."<?xml version='1.0' encoding='UTF-8' ?>\n"                      // No
    ."<!DOCTYPE MKS SYSTEM 'http://www.classaxe.com/mks/mks.dtd'>\n"
    ."<?xml-stylesheet type='text/xsl' href='mks.xslt' ?>\n"          // No
    ."<MKS>"
    ."  <USERLIST>"
    ."  <USER userAcctName='Martin' "
    ."userAcctEmail='martin@classaxe.com'/>\n" // OK
    ."  </USERLIST>"
    ."</MKS>"
  );
?>

For test purposes I'd like to be able to remove a stylesheet reference (second // No) but this causes a parse error when the line is an XML construct.   The Block comment /* ... */ works however.

Other configs tested and failed:
PHP 4.0.6 on Linux 2.0.36 / Apache/1.3.23 (XML active)
PHP 4.2.1 on FreeBSD 4.4-RELEASE #0 / Apache/1.3.26 (XML all active)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-25 10:28 UTC] sander@php.net
Expected behaviour. ?> causes PHP to stop parsing.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 08:00:02 2026 UTC