mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16190: Using reflection to call Dom\Node::__construct causes assertion failure
This commit is contained in:
@@ -2548,7 +2548,7 @@ PHP_METHOD(Dom_Node, compareDocumentPosition)
|
|||||||
|
|
||||||
PHP_METHOD(Dom_Node, __construct)
|
PHP_METHOD(Dom_Node, __construct)
|
||||||
{
|
{
|
||||||
ZEND_UNREACHABLE();
|
zend_throw_error(NULL, "Cannot directly construct %s, use document methods instead", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
PHP_METHOD(DOMNode, __sleep)
|
PHP_METHOD(DOMNode, __sleep)
|
||||||
|
|||||||
18
ext/dom/tests/gh16190.phpt
Normal file
18
ext/dom/tests/gh16190.phpt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
--TEST--
|
||||||
|
GH-16190 (Using reflection to call Dom\Node::__construct causes assertion failure)
|
||||||
|
--EXTENSIONS--
|
||||||
|
dom
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$doc = Dom\XMLDocument::createEmpty();
|
||||||
|
$rm = new ReflectionMethod($doc, '__construct');
|
||||||
|
try {
|
||||||
|
$rm->invoke($doc);
|
||||||
|
} catch (Error $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Cannot directly construct Dom\XMLDocument, use document methods instead
|
||||||
Reference in New Issue
Block a user