[php-src] PR #25932: Fix DateTime::modify('1400') keeping stale microseconds
| From: | lacatoire | Date: | Mon, 30 Nov 2026 09:39:13 +0000 |
| Subject: | [php-src] PR #25932: Fix DateTime::modify('1400') keeping stale microseconds | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41232@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25932
Author: lacatoire
modify('1400') keeps the previous microseconds, while
modify('14:00') resets them. The compact time format leaves the microseconds
unset in the parsed time, and php_date_modify() only copied them when set. An absolute
time of day now resets them.
### To reproduce
```php
<?php
$d = new DateTime('2024-01-01 10:30:45.123456');
$d->modify('1400');
echo $d->format('Y-m-d H:i:s.u'), "\n";
```
Before (8.4.28, 8.5.12, 8.6.0): 2024-01-01 14:00:00.123456
After: 2024-01-01 14:00:00.000000