php.net |  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
 [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
http://www.w3.org/TR/2000/REC-xml-20001006#dt-etag

   "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.


<?php

   #  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";
   }

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-05 15:27 UTC] sniper@php.net
http://www.php.net/manual/en/function.xml-parse.php

Look at the 'isFinal' parameter..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC