#19239 [NEW]: missing end-tags not being cought as errors
| From: | danielc at analysisandsolutions dot com | Date: | Thu, 05 Sep 2002 03:01:41 +0000 |
| Subject: | #19239 [NEW]: missing end-tags not being cought as errors | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-18467@lists.php.net to get a copy of this message | ||
From: danielc@analysisandsolutions.com
Operating system: NT 4.0 and FreeBSD 4.1.1
PHP version: 4.2.2
PHP Bug Type: *XML functions
Bug description: missing end-tags not being cought as errors
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";
}
?>
--
Edit bug report at http://bugs.php.net/?id=19239&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19239&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19239&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19239&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19239&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19239&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19239&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19239&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19239&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19239&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19239&r=globals