Issue: https://github.com/php/php-src/issues/9401
Author: rimace
### Description
The following code:
```php
<?php
class CustomDateTime extends \DateTime
{ }
$begin = new CustomDateTime('2012-08-01');
$end = new CustomDateTime('2012-08-31');
$period = new \DatePeriod($begin, new \DateInterval('P1D'), $end);
foreach ($period as $day) {
echo get_class($day);
exit;
}
```
Resulted in this output:
```
DateTime
```
But I expected this output instead:
```
CustomDateTime
```
This change in behaviour was introduced with a bug-fix release 8.1.9. It worked with 8.1.7.
### PHP Version
PHP 8.1.9
### Operating System
Windows + Ubuntu