While constructing tests for #3, I found a different oddity: currently, I'm relying on ->getNamespaces(false) returning the namespace of the current element, but that's not actually what it does. Instead, it lists all namespaces used by the current element, including its attributes.
Here, the prefix test is used in the element (by the attribute) but isn't the namespace to which the element belongs. Since there is no default namespace defined, there's no '' key in the getNamespaces output, so the output is [ 'test' => 'http://example.com' ], leading to broken dump output.
While constructing tests for #3, I found a different oddity: currently, I'm relying on
->getNamespaces(false)
returning the namespace of the current element, but that's not actually what it does. Instead, it lists all namespaces used by the current element, including its attributes.Consider the following:
Here, the prefix
test
is used in the element (by the attribute) but isn't the namespace to which the element belongs. Since there is no default namespace defined, there's no''
key in thegetNamespaces
output, so the output is[ 'test' => 'http://example.com' ]
, leading to broken dump output.