Bug #77895 [Asn->Csd]: IntlDateFormatter::create fails in strict mode if $locale = null
Edit report at https://bugs.php.net/bug.php?id=77895&edit=1
ID: 77895
Updated by: nikic@php.net
Reported by: misley dot marton at webdream dot hu
Summary: IntlDateFormatter::create fails in strict mode if
$locale = null
-Status: Assigned
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: docker php:7.2-apache
PHP Version: 7.2.17
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=619c4e9f2e772557d3bdaa4e23f8392dc7f4c499
Log: Fixed bug #77895
Previous Comments:
------------------------------------------------------------------------
[2019-04-15 11:53:10] misley dot marton at webdream dot hu
phpcode without the double assign
<?php
declare(strict_types=1);
$formatter = \IntlDateFormatter::create(null, \IntlDateFormatter::NONE, \IntlDateFormatter::NONE);
------------------------------------------------------------------------
[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
Thread (3 messages)