[php-src] Issue #10747: Regression: Private fields in serialized DateTimeImmutable objects throw

From: Date: Thu, 02 Mar 2023 01:21:48 +0000
Subject: [php-src] Issue #10747: Regression: Private fields in serialized DateTimeImmutable objects throw
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243832@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10747 Author: bwoebi ### Description The following code: ```php <?php class I extends DateTimeImmutable { private $var = 1; } unserialize(serialize(new I)); ``` Resulted in this output: ``` Fatal error: Uncaught Error: Cannot access property starting with "\0" in Command line code:1 Stack trace: #0 [internal function]: DateTimeImmutable->__unserialize(Array) #1 Command line code(1): unserialize('O:1:"I":4:{s:4:...') #2 {main} thrown in Command line code on line 1 ``` This breaks unserialization of monolog log data (https://github.com/Seldaek/monolog/blob/d3d495b742cacf9c0af87867bf87dab2fc591e68/src/Monolog/DateTimeImmutable.php) which uses a private property. This still works on PHP 8.2.3. ### PHP Version PHP 8.2.4RC1 ### Operating System _No response_

« previous php.bugs (#243832) next »