[php-src] Issue #8217: new DateTime("@".$timestamp) should not crash (throws fatal error) with empty timestamp
| From: | kamil-tekiela | Date: | Fri, 18 Mar 2022 12:40:21 +0000 |
| Subject: | [php-src] Issue #8217: new DateTime("@".$timestamp) should not crash (throws fatal error) with empty timestamp | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240405@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8217
Comment Author: kamil-tekiela
Thanks for the report but I don't really understand why you think there should be no error.
Luckily for you, the procedural API doesn't throw errors, so you can use that and check for
errors manually.
```
<?php
$timestamp = null;
$date = date_create("@".$timestamp); // @ Forcing to UTC
```