[php-src] Issue #9434: `new ArrayObject($targetObject)` allows setting typed properties to invalid types

From: Date: Fri, 26 Aug 2022 13:32:45 +0000
Subject: [php-src] Issue #9434: `new ArrayObject($targetObject)` allows setting typed properties to invalid types
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242316@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9434 Author: TysonAndre ### Description The following code: ```php <?php class C { public int $intProp; } $c = new C(); $a = new ArrayObject($c); $a['intProp'] = []; var_export($c); // Alternate snippet that would be an Uncaught TypeError: Cannot assign array to property C::$intProp of type int // unset($c->intProp); // $c->intProp = []; ``` Resulted in this output: ``` \C::__set_state(array( 'intProp' => array ( ), )) ``` But I expected this output instead: ``` Uncaught TypeError: Cannot assign array to property C::$intProp of type int ``` Related to #9432 Discovered while reviewing #9354 ### PHP Version PHP 7.4+ ### Operating System _No response_

« previous php.bugs (#242316) next »