[php-src] Issue #11416: DatePeriod can crash if passed non initialized DateInterfaces

From: Date: Fri, 09 Jun 2023 14:58:57 +0000
Subject: [php-src] Issue #11416: DatePeriod can crash if passed non initialized DateInterfaces
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244648@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11416 Author: arnaud-lb ### Description Found these while working on lazy objects. The following code snippets result in crashes: ```php <?php $date = (new ReflectionClass(DateTime::class))->newInstanceWithoutConstructor(); new DatePeriod($date, new DateInterval('P1D'), 2); ``` ```php <?php $date = (new ReflectionClass(DateTime::class))->newInstanceWithoutConstructor(); $dateperiod = (new ReflectionClass(DatePeriod::class))->newInstanceWithoutConstructor(); $dateperiod->__unserialize(['start' => $date]); // __wakeup is also affected ``` ### PHP Version PHP 8.1 ### Operating System _No response_

« previous php.bugs (#244648) next »