|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19239 missing end-tags not being cought as errors
Submitted: 2002-09-04 22:01 UTC Modified: 2002-09-05 15:27 UTC
From: danielc at analysisandsolutions dot com Assigned:
Status: Not a bug Package: XML related
PHP Version: 4.2.2 OS: NT 4.0 and FreeBSD 4.1.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: danielc at analysisandsolutions dot com
New email:
PHP Version: OS:


 [2002-09-04 22:01 UTC] danielc at analysisandsolutions dot com
XML documents with missing closing tags at the end of
the data are not considered well-formed according to

   "The end of every element that begins with a start-tag
   must be marked by an end-tag containing a name that
   echoes the element's type as given in the start-tag"

But, PHP's xml_parse() function isn't rejecting them.

This is happening in PHP 4.2.2 on Windows NT and 4.1.2 on
FreeBSD 4.1.1.


   #  This is well-formed and parses fine.

   $Contents = '<?xml version="1.0"?>
   <!DOCTYPE TEST SYSTEM "foo.dtd">
   <T>Some Data</T>';

   #  This is NOT well-formed BUT parses.

   $Contents = '<?xml version="1.0"?>
   <!DOCTYPE TEST SYSTEM "foo.dtd">
   <T>Some Data';

   $Parser = xml_parser_create('ISO-8859-1');

   if ( xml_parse($Parser, $Contents) ) {
      echo "Parsed fine.\n";
   } else {
      echo "Had problem parsing file:\n   "
       . xml_error_string(xml_get_error_code($Parser));
      echo "\n";



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-05 15:27 UTC]

Look at the 'isFinal' parameter..

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 08 23:05:53 2022 UTC