php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77895 IntlDateFormatter::create fails in strict mode if $locale = null
Submitted: 2019-04-15 11:51 UTC Modified: 2019-04-15 13:20 UTC
From: misley dot marton at webdream dot hu Assigned: nikic (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 7.2.17 OS: docker php:7.2-apache
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: misley dot marton at webdream dot hu
New email:
PHP Version: OS:

 

 [2019-04-15 11:51 UTC] 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);



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-15 11:53 UTC] 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 13:20 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2019-04-15 13:28 UTC] nikic@php.net
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
 [2019-04-15 13:28 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC