Skip to content

Attributes in default namespace behave oddly #3

Description

@IMSoP

There seems to be a bug (or misfeature?) in SimpleXML where attributes in the default namespace don't show if you call ->attributes($default_namespace_uri) rather than ->attributes('', true).

Because of simplexml_dump's attempts to display namespace information, this leads to data disappearing from view with innocuous XML like this:

<?php
include 'simplexml_dump.php';

$xml = <<<XML
<?xml version="1.0"?>
<Foo xmlns="http://example.com">
        <Bob InvisibleAttribute="You ain't seen me, right?">
                <MaskingChildElement />
        </Bob>
</Foo>
XML;

$sx_Foo = simplexml_load_string($xml);
simplexml_dump($sx_Foo->Bob);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions