mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
The zend_hash_update_ind() variant unwraps indirects, rather than creating them. Don't use _zend_hash_append_ind() because the property might already exist. Fixes GH-16725 Closes GH-16805
28 lines
491 B
PHP
28 lines
491 B
PHP
--TEST--
|
|
GH-16725: Incorrect access check for non-hooked props in hooked object iterator
|
|
--FILE--
|
|
<?php
|
|
|
|
class C implements JsonSerializable
|
|
{
|
|
private string $prop1 { get => 'bar'; }
|
|
|
|
public function __construct(
|
|
private string $prop2,
|
|
) {}
|
|
|
|
public function jsonSerialize(): mixed {
|
|
return get_object_vars($this);
|
|
}
|
|
}
|
|
|
|
$obj = new C('foo');
|
|
var_dump(get_object_vars($obj));
|
|
echo json_encode($obj);
|
|
|
|
?>
|
|
--EXPECT--
|
|
array(0) {
|
|
}
|
|
{"prop1":"bar","prop2":"foo"}
|