mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

I forgot to also update the document reference of attributes, so when there is no document reference anymore from a variable, but still an attribute, this can crash. Fix it by also updating the document references for attributes. Closes GH-13002.
27 lines
653 B
PHP
27 lines
653 B
PHP
--TEST--
|
|
DOMDocument::adoptNode() with attribute references
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
|
|
$dom = new DOMDocument;
|
|
$root = $dom->appendChild($dom->createElement('root'));
|
|
$root->setAttributeNS("urn:a", "a:root1", "bar");
|
|
$root1 = $root->getAttributeNodeNS("urn:a", "root1");
|
|
echo $dom->saveXML();
|
|
|
|
$dom = new DOMDocument;
|
|
$dom->appendChild($dom->adoptNode($root));
|
|
foreach ($dom->documentElement->attributes as $attr) {
|
|
var_dump($attr->namespaceURI, $attr->prefix, $attr->localName, $attr->nodeValue);
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
<?xml version="1.0"?>
|
|
<root xmlns:a="urn:a" a:root1="bar"/>
|
|
string(5) "urn:a"
|
|
string(1) "a"
|
|
string(5) "root1"
|
|
string(3) "bar"
|