Bug #66850 [Nab]: Different behaviors of loadXML
Edit report at https://bugs.php.net/bug.php?id=66850&edit=1
ID: 66850
Updated by: ab@php.net
Reported by: goetas at lignano dot it
Summary: Different behaviors of loadXML
Status: Not a bug
Type: Bug
Package: DOM XML related
Operating System: windows/linux (ubuntu)
PHP Version: 5.5.10
Block user comment: N
Private report: N
New Comment:
No, I'm trying to tell exactly the opposite, that's not a libxml issue. A valid XML were
at least <root><div/></root>, not even telling about specifying the XML version as
well. Reading this also http://www.w3.org/TR/REC-xml-names/#iri-use ,
if specifying <ns:tag/> when ns is undefined, so empty, but otherwise the document were
somehow valid, it were logic to cut off an empty URI at the out. As obviously libxml should not
produce invalid XML, but might use a sort of "quirks mode" when reading in.
Previous Comments:
------------------------------------------------------------------------
[2014-03-11 15:29:11] goetas at lignano dot it
I agree with you, that is an libxml issue,
But sounds strange that:
// NOT valid XML
laodXML('...') // return false
// Valid XML
laodXML('<div/>') // return true
// NOT Valid XML
laodXML('<t:div/>') // return true but should be false
I do non know about libxml internals, but if it raises a warning, can it be used to sets to
'false' the "laodXML" return value?
------------------------------------------------------------------------
[2014-03-11 15:12:20] ab@php.net
Have you already played with the properties available in the DOMDocument? That way you could affect
the behavior of the libxml in some way, maybe that helps.
But generally I can just repeat that an invalid XML has an unpredictable effect, even if you prefer
to call it a libxml issue :) Like say a namespace string itself isn't that important, the
important thing is the URI which should have been defined. Say two namespaces a: and b: might be the
same in different documents if they were defined with the same URI. But this all is actually far
from the case if you had a perfectly valid document.
------------------------------------------------------------------------
[2014-03-11 14:40:56] goetas at lignano dot it
The decision if "DOMDocument::loadXML" worked properly, should be based only on
"loadXML" return value.
Should not be linked to warnings or internal libxml issues.
Currently i have to check if "loadXML" returns true and also if
"libxml_get_errors" is emply or not...
------------------------------------------------------------------------
[2014-03-11 14:22:19] ab@php.net
You can see the relevant code here http://lxr.php.net/xref/PHP_5_6/ext/dom/document.c#dom_document_parser
. Generally we rely on libxml, so if it could parse, that's the precondition for the DOM
extension to work further.
------------------------------------------------------------------------
[2014-03-11 12:59:51] goetas at lignano dot it
But if it is not a bug, why loadXML() returns a 'true'?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=66850
--
Edit this bug report at https://bugs.php.net/bug.php?id=66850&edit=1
Thread (9 messages)