mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
08c4db7f36
Closes GH-11894.
35 lines
848 B
PHP
35 lines
848 B
PHP
--TEST--
|
|
Manually call __construct() - attribute variation
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
|
|
$attr = new DOMAttr("attribute", "my value");
|
|
var_dump($attr->nodeName, $attr->nodeValue);
|
|
$attr->__construct("newattribute", "my new value");
|
|
var_dump($attr->nodeName, $attr->nodeValue);
|
|
|
|
$doc = new DOMDocument();
|
|
$doc->loadXML(<<<XML
|
|
<?xml version="1.0"?>
|
|
<container/>
|
|
XML);
|
|
$doc->documentElement->setAttributeNode($attr);
|
|
echo $doc->saveXML();
|
|
|
|
$attr->__construct("newnewattribute", "my even newer value");
|
|
$doc->documentElement->setAttributeNode($attr);
|
|
echo $doc->saveXML();
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(9) "attribute"
|
|
string(8) "my value"
|
|
string(12) "newattribute"
|
|
string(12) "my new value"
|
|
<?xml version="1.0"?>
|
|
<container newattribute="my new value"/>
|
|
<?xml version="1.0"?>
|
|
<container newattribute="my new value" newnewattribute="my even newer value"/>
|