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
|
--TEST--
Unsetting properties
--EXTENSIONS--
dom
--FILE--
<?php
class MyElement extends DOMElement {
public int $myProp = 3;
}
$dom = new DOMDocument;
$dom->registerNodeClass('DOMElement', 'MyElement');
$dom->loadXML('<root>foo</root>');
$root = $dom->documentElement;
unset($root->myProp);
try {
$root->myProp;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
unset($root->textContent);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Typed property MyElement::$myProp must not be accessed before initialization
Cannot unset MyElement::$textContent
|