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-17991: Assertion failure dom_attr_value_write
This commit is contained in:
Niels Dossche
2025-03-07 22:43:48 +01:00
2 changed files with 32 additions and 3 deletions

View File

@@ -367,13 +367,14 @@ static zend_always_inline const dom_prop_handler *dom_get_prop_handler(const dom
if (obj->prop_handler != NULL) {
if (cache_slot && *cache_slot == obj->prop_handler) {
hnd = *(cache_slot + 1);
hnd = cache_slot[1];
}
if (!hnd) {
hnd = zend_hash_find_ptr(obj->prop_handler, name);
if (cache_slot) {
*cache_slot = obj->prop_handler;
*(cache_slot + 1) = (void *) hnd;
cache_slot[0] = obj->prop_handler;
cache_slot[1] = (void *) hnd;
cache_slot[2] = NULL;
}
}
}

View File

@@ -0,0 +1,28 @@
--TEST--
GH-17991 (Assertion failure dom_attr_value_write)
--EXTENSIONS--
dom
--FILE--
<?php
$attr = new DOMAttr("r", "iL");
class Box {
public ?Test $value;
}
class Test {
}
function test($box) {
var_dump($box->value = new Test);
}
$box = new Box();
test($box);
test($attr);
?>
--EXPECTF--
object(Test)#%d (0) {
}
Fatal error: Uncaught TypeError: Cannot assign Test to property DOMAttr::$value of type string in %s:%d
Stack trace:
#0 %s(%d): test(Object(DOMAttr))
#1 {main}
thrown in %s on line %d