[php-src] Issue #10357: DateTime modify function backward compatibility break on 8.2
| From: | pkusmierczyk | Date: | Tue, 17 Jan 2023 11:21:04 +0000 |
| Subject: | [php-src] Issue #10357: DateTime modify function backward compatibility break on 8.2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243476@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10357
Author: pkusmierczyk
### Description
The following code:
```php
<?php
$modifiedDate = (new DateTime('2023-01-17'))->modify(sprintf('+%s days',
$days))->format('Y-m-d');
```
Resulted in this output:
For values of
$days lower than 0 results are incorrect (according to version 8.1). If
value is -1 we get
```
'2023-01-18'
```
But I expected this output instead:
```
'2023-01-16'
```
### PHP Version
8.2
### Operating System
Ubuntu 20.04