Bug #75052 [NEW]: DateTime::__construct first argument null
| From: | tim_siebels_aurich at yahoo dot de | Date: | Tue, 08 Aug 2017 18:25:03 +0000 |
| Subject: | Bug #75052 [NEW]: DateTime::__construct first argument null | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210559@lists.php.net to get a copy of this message | ||
From: tim_siebels_aurich at yahoo dot de
Operating system:
PHP version: 7.2.0beta2
Package: Date/time related
Bug Type: Bug
Bug description:DateTime::__construct first argument null
Description:
------------
The documentation for the DateTime constructor says that when using the
$timezone parameter, the first parameter may be null [1].
Enabling strict types, an exception is thrown [2].
[1]
http://php.net/manual/en/datetime.construct.php#refsect1-datetime.construct-parameters
[2] https://3v4l.org/DKdFT
Test script:
---------------
<?php
declare(strict_types=1);
var_dump((new DateTime(null, new
DateTimeZone('Europe/Berlin')))->format('d-m-Y H:i'));
Expected result:
----------------
Current time
Actual result:
--------------
Fatal error: Uncaught TypeError: DateTime::__construct() expects
parameter 1 to be string, null given in line 3
--
Edit bug report at https://bugs.php.net/bug.php?id=75052&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75052&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75052&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75052&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75052&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75052&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75052&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75052&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75052&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75052&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75052&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75052&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75052&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75052&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75052&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75052&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75052&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75052&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75052&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75052&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75052&r=mysqlcfg