-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Description
The following code:
<?php
$d = @\Dom\HTMLDocument::createFromString("<div></div>");
$e = $d->getElementsByTagName("div")[0];
$e->innerHTML = '<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace"></svg>';
$svg = $d->querySelector("svg");
echo $e->innerHTML."\n";
echo $svg->attributes[0]->localName." ".var_export($svg->attributes[0]->namespaceURI, true)."\n";Resulted in this output:
<svg space="default" xlink:href="about:blank" xmlns:foo="barspace"></svg>
space NULL
But I expected this output instead:
<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace"></svg>
space 'http://www.w3.org/XML/1998/namespace'
Note this case is covered by the test suite here:
https://github.com/html5lib/html5lib-tests/blob/8f43b7ec8c9d02179f5f38e0ea08cb5000fb9c9e/tree-construction/webkit02.dat#L363
PHP Version
PHP 8.5.4 (cli) (built: Mar 11 2026 12:09:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.4, Copyright (c) Zend Technologies
with Zend OPcache v8.5.4, Copyright (c), by Zend Technologies
Operating System
Arch Linux
Reactions are currently unavailable