mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-16190: Using reflection to call Dom\Node::__construct causes assertion failure
Closes GH-16193.
This commit is contained in:
2
NEWS
2
NEWS
@@ -31,6 +31,8 @@ PHP NEWS
|
||||
DOMElement->getAttributeNames()). (nielsdos)
|
||||
. Fixed bug GH-16151 (Assertion failure in ext/dom/parentnode/tree.c).
|
||||
(nielsdos)
|
||||
. Fixed bug GH-16190 (Using reflection to call Dom\Node::__construct
|
||||
causes assertion failure). (nielsdos)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug GHSA-865w-9rf3-2wh5 (Logs from childrens may be altered).
|
||||
|
||||
@@ -2548,7 +2548,7 @@ PHP_METHOD(Dom_Node, compareDocumentPosition)
|
||||
|
||||
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)
|
||||
|
||||
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