mirror of
https://github.com/php/php-src.git
synced 2026-10-29 10:22:06 +08:00
* zend_API: Verify property types in `object_properties_load()` Fixes php/php-src#9708. * zend_API: Fix various issues in `object_properties_load()` Fixes Fixes php/php-src#9707. Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com> * NEWS * random: Remove now-obsolete manual `$engine` type check in `Randomizer::__unserialize()` * zend_API: Make `object_properties_load()` use `strict_types=1` This is consistent with regular unserialization, which also performs strict type checking. Co-authored-by: Gina Peter Banyard <girgias@php.net> * Block creation of readonly reference properties Co-authored-by: Arnaud Le Blanc <365207+arnaud-lb@users.noreply.github.com> --------- Co-authored-by: Nora Dossche <7771979+ndossche@users.noreply.github.com> Co-authored-by: Gina Peter Banyard <girgias@php.net> Co-authored-by: Arnaud Le Blanc <365207+arnaud-lb@users.noreply.github.com>
42 lines
631 B
PHP
42 lines
631 B
PHP
--TEST--
|
|
GH-9707: object_properties_load crashes in debug mode when unserializing references to typed properties in php 8.1+
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo extends ArrayObject {
|
|
public int $a = 0;
|
|
public int $b = 0;
|
|
}
|
|
|
|
$f = new Foo();
|
|
$r = &$f->a;
|
|
$f->b = &$r;
|
|
|
|
$f->b = 1;
|
|
var_dump($unserialized = unserialize(serialize($f)));
|
|
|
|
$unserialized->b = 2;
|
|
|
|
var_dump($unserialized);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
object(Foo)#%d (3) {
|
|
["a"]=>
|
|
&int(1)
|
|
["b"]=>
|
|
&int(1)
|
|
["storage":"ArrayObject":private]=>
|
|
array(0) {
|
|
}
|
|
}
|
|
object(Foo)#%d (3) {
|
|
["a"]=>
|
|
&int(2)
|
|
["b"]=>
|
|
&int(2)
|
|
["storage":"ArrayObject":private]=>
|
|
array(0) {
|
|
}
|
|
}
|