php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75768 libxml_get_errors function report different error in the same conditions
Submitted: 2018-01-05 18:47 UTC Modified: 2018-01-05 21:37 UTC
From: laurentiusilviu at gmail dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.6.33 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 24 = ?
Subscribe to this entry?

 
 [2018-01-05 18:47 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-05 21:37 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-01-05 21:37 UTC] requinix@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 21:01:36 2024 UTC