Bug #77895 [Opn]: IntlDateFormatter::create fails in strict mode if $locale = null
| From: | misley dot marton at webdream dot hu | Date: | Mon, 15 Apr 2019 11:53:10 +0000 |
| Subject: | Bug #77895 [Opn]: IntlDateFormatter::create fails in strict mode if $locale = null | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220460@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77895&edit=1
ID: 77895
User updated by: misley dot marton at webdream dot hu
Reported by: misley dot marton at webdream dot hu
Summary: IntlDateFormatter::create fails in strict mode if
$locale = null
Status: Open
Type: Bug
Package: Unknown/Other Function
Operating System: docker php:7.2-apache
PHP Version: 7.2.17
Block user comment: N
Private report: N
New Comment:
phpcode without the double assign
<?php
declare(strict_types=1);
$formatter = \IntlDateFormatter::create(null, \IntlDateFormatter::NONE, \IntlDateFormatter::NONE);
Previous Comments:
------------------------------------------------------------------------
[2019-04-15 11:51:30] misley dot marton at webdream dot hu
Description:
------------
https://www.php.net/manual/en/intldateformatter.create.php
In the docs it sais at parameters section:
"locale: Locale to use when formatting or parsing or NULL to use the value specified in the ini
setting intl.default_locale."
If you try to use strict mode with locale = null, the script fails with
"PHP Fatal error: Uncaught TypeError: IntlDateFormatter::create() expects parameter 1 to be
string, null given in ..."
Test script:
---------------
<?php
declare(strict_types=1);
$format = $formatter = \IntlDateFormatter::create(null, \IntlDateFormatter::NONE,
\IntlDateFormatter::NONE);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77895&edit=1