1
0
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:
Niels Dossche
2024-10-03 19:26:14 +02:00
2 changed files with 19 additions and 1 deletions

View File

@@ -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)

View 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