summaryrefslogtreecommitdiff
path: root/ext/dom/tests/bug47430.phpt
blob: 2d5733fe31562d298badab096d8cef33a702b590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
Bug #47430 (Errors after writing to nodeValue parameter of an absent previousSibling).
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$xml = '<?xml
version="1.0"?><html><p><i>Hello</i></p><p><i>World!</i></p></html>';
$dom = new DOMDocument();
$dom->loadXML($xml);

$elements = $dom->getElementsByTagName('i');
foreach ($elements as $i) {
    try {
        $i->previousSibling->nodeValue = '';
    } catch (Error $e) {
        echo $e->getMessage(), "\n";
    }
}

$arr = array();
$arr[0] = 'Value';

print_r($arr);

?>
--EXPECT--
Attempt to assign property 'nodeValue' on null
Attempt to assign property 'nodeValue' on null
Array
(
    [0] => Value
)