[php-src] Issue #15032: setTimestamp sets the wrong value
| From: | amavica | Date: | Fri, 19 Jul 2024 16:04:19 +0000 |
| Subject: | [php-src] Issue #15032: setTimestamp sets the wrong value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247326@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15032
Author: amavica
### Description
The following code:
```php
<?php
$timestamp = 1671586388072;
$datetime = (new DateTime())->setTimestamp($timestamp);
var_dump($datetime);
```
Resulted in this output:
```
object(DateTime)#1 (3) {
["date"]=>
string(28) "+54940-06-18 16:14:32.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
```
But I expected this output instead:
```
object(DateTime)#1 (3) {
["date"]=>
string(26) "2022-12-21 10:33:08.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
```
### PHP Version
8.2.19
### Operating System
_No response_