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' into PHP-8.5

* PHP-8.4:
  Add forgotten NEWS item
  Partially fix GH-16317: DOM classes do not allow __debugInfo() overrides to work
This commit is contained in:
Niels Dossche
2025-10-13 18:45:34 +02:00
2 changed files with 26 additions and 0 deletions

View File

@@ -488,6 +488,7 @@ static void dom_unset_property(zend_object *object, zend_string *member, void **
zend_std_unset_property(object, member, cache_slot);
}
/* This custom handler is necessary to avoid a recursive construction of the entire subtree. */
static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /* {{{ */
{
dom_object *obj = php_dom_obj_from_obj(object);
@@ -498,6 +499,11 @@ static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /
dom_prop_handler *entry;
zend_string *object_str;
/* As we have a custom implementation, we must manually check for overrides. */
if (object->ce->__debugInfo) {
return zend_std_get_debug_info(object, is_temp);
}
*is_temp = 1;
std_props = zend_std_get_properties(object);

View File

@@ -0,0 +1,20 @@
--TEST--
GH-16317 (DOM classes do not allow __debugInfo() overrides to work)
--FILE--
<?php
class Demo extends DOMNode {
public function __construct() {}
public function __debugInfo(): array {
return ['x' => 'y'];
}
}
var_dump(new Demo());
?>
--EXPECT--
object(Demo)#1 (1) {
["x"]=>
string(1) "y"
}