[php-src] Issue #8217: new DateTime("@".$timestamp) should not crash (throws fatal error) with empty timestamp
| From: | heiglandreas | Date: | Fri, 18 Mar 2022 12:50:13 +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-240406@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8217
Comment Author: heiglandreas
This is not a but.
Similar illegal requests throw the same exception like for example
new
DateTime('null');. It is your responsibility as a developer to make sure that
something sensible is passed to the constructor.
As a side-note: UTC is not "forced". A timestamp is by it's very own
[definition](https://en.wikipedia.org/wiki/Unix_time#Definition) "the seconds passed since 1st
of January 00:00:00 UTC". So a timestamp is **always** based on UTC and a DateTime(Immutable)
object created from one can not have any other timezone than UTC.