|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39980 PHP functions that read xml try to validate that the namespace uri exsist,wrong
Submitted: 2006-12-28 19:48 UTC Modified: 2006-12-28 21:52 UTC
From: hatkyinc at gmail dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.2.0 OS: Windows xp sp2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: hatkyinc at gmail dot com
New email:
PHP Version: OS:


 [2006-12-28 19:48 UTC] hatkyinc at gmail dot com
A lot of php functions that read xml try to validate that the uri exsist, which is wrong by

If the xmlns uri is not valid the functions don't work at all.

Functions tried: 

I am opening this after opening a problem with which create the problematic xml, they realied the fallowing: is a namespace URI, and there is no
requirement for it to actually point to anything - it's just an identifier.  If
something makes an assumption that it can retrieve anything at all from a
namespace URI, it needs to be fixed not to assume that, let alone try it

Reproduce code:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="">
<m:markupvalidationresponse env:encodingStyle="" xmlns:m="">
    <m:doctype>-//W3C//DTD HTML 4.0 Transitional//EN</m:doctype>
                <m:message>there is no attribute &quot;TABINDEX&quot;</m:message>
                <m:message>document type does not allow element &quot;DIV&quot; here; missing one of &quot;APPLET&quot;, &quot;OBJECT&quot;, &quot;MAP&quot;, &quot;IFRAME&quot;, &quot;BUTTON&quot; start-tag</m:message>
                <m:message>document type does not allow element &quot;DIV&quot; here; missing one of &quot;APPLET&quot;, &quot;OBJECT&quot;, &quot;MAP&quot;, &quot;IFRAME&quot;, &quot;BUTTON&quot; start-tag</m:message>
                <m:message>there is no attribute &quot;TABINDEX&quot;</m:message>
                <m:message>there is no attribute &quot;ONFOCUS&quot;</m:message>

$uri ='c:\a.xml';

$handle = fopen($uri, "r");

$contents = '';
while (!feof($handle)) {
  $contents .= fread($handle, 8192);

//echo $contents;

$entries = new  SimpleXMLElement($contents);

$result= $entries->children('')->Body->children('')->markupvalidationresponse;
echo $result->uri ;

Expected result:
expected to put on screen

Actual result:
Nothing is put on screen.

if you change a.xml line
<m:markupvalidationresponse env:encodingStyle="" xmlns:m="">

xmlns:m= uri to anything that validates this works 
<m:markupvalidationresponse env:encodingStyle="" xmlns:m="">


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-28 21:22 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

 [2006-12-28 21:38 UTC] hatkyinc at gmail dot com
I don't understand why you say this is not a problem in PHP?

I give here an exact code with a valid input and show it dosn't work and a case that is does work.

From my understanding there is either a problem in some XML validation or parsing code.

I don't see the reason for refering me to support, I show you a code that work and an exact case it breaks where is should still work and link to the reason why it is a valid case that should still work.

Please say why do you think is it ok for PHP not to work in this case (with this valide input XML)?
 [2006-12-28 21:52 UTC]
no bug here except in your code
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 13:01:30 2024 UTC