Bug #75768 [Opn->Nab]: libxml_get_errors function report different error in the same conditions
| From: | requinix@php.net | Date: | Fri, 05 Jan 2018 21:37:48 +0000 |
| Subject: | Bug #75768 [Opn->Nab]: libxml_get_errors function report different error in the same conditions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213392@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75768&edit=1
ID: 75768
Updated by: requinix@php.net
Reported by: laurentiusilviu at gmail dot com
Summary: libxml_get_errors function report different error in
the same conditions
-Status: Open
+Status: Not a bug
Type: Bug
Package: SimpleXML related
Operating System: Windows 7
PHP Version: 5.6.33
Block user comment: N
Private report: N
New Comment:
This behavior comes from libxml, not PHP.
http://xmlsoft.org/bugs.html
Looks like it reads the end tag by trying to find the start tag's name then requiring that the
next character is a '>'. Since "def" (</def>) begins with
"de" (<de>) the parser thinks it finds the end tag correctly but errors since the
next character is a 'f'. If you changed the start or end so that this doesn't happen
(eg, <def> and </df>) you'll get the tag mismatched message.
Previous Comments:
------------------------------------------------------------------------
[2018-01-05 18:47:44] laurentiusilviu at gmail dot com
Description:
------------
I use XAMPP 5.6.32
I have this XML string:
<abc>
<def>
Content
</def>
</abc>
and I used the functions from here: http://php.net/manual/ro/function.libxml-get-errors.php
to get XML errors
Test script:
---------------
Case 1:
In order to have an error in XML file, I replaced <dfe> with <dfeg>
Returned error:
Fatal Error 76: Opening and ending tag mismatch: defg line 3 and def Line: 5 Column: 11
Result seems to be ok;
Case 2:
In order to have the same error in XML file, I replaced <dfe> with <df>
Returned error:
Fatal Error 73: expected '>' Line: 5 Column: 6
Result: In my opinion, it is not relevant. I expected to have the same error message as in Case 1.
Expected result:
----------------
I expected to have the same result in both cases.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75768&edit=1