php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81606 Mistyped IntlDateFormatter::__construct() arguments
Submitted: 2021-11-10 20:07 UTC Modified: 2021-11-12 09:42 UTC
From: cedric dot anne at gmail dot com Assigned: nikic (profile)
Status: Closed Package: I18N and L10N related
PHP Version: 8.1.0RC5 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 + 31 = ?
Subscribe to this entry?

 
 [2021-11-10 20:07 UTC] cedric dot anne at gmail dot com
Description:
------------
According to PHP documentation, arguments $dateType and $timeType of IntlDateFormatter::__construct() should accept null values.

On PHP 8.1, when using null values, a deprecation error is triggered:
> PHP Deprecated:  IntlDateFormatter::__construct(): Passing null to parameter #2 ($dateType) of type int is deprecated

Test script:
---------------
<?php
$formatter = new IntlDateFormatter('de_DE', 'Europe/Berlin', null, null, 'dd-MM');
echo $formatter->format(new DateTime('2012-07-02T22:44:03Z'));



Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-10 20:59 UTC] cedric dot anne at gmail dot com
The following pull request has been associated:

Patch Name: Fix expected type of IntlDateFormatter::__construct() arguments
On GitHub:  https://github.com/php/php-src/pull/7640
Patch:      https://github.com/php/php-src/pull/7640.patch
 [2021-11-11 11:19 UTC] nikic@php.net
-Package: intl +Package: I18N and L10N related
 [2021-11-11 20:59 UTC] cedric dot anne at gmail dot com
The following pull request has been associated:

Patch Name: Fix IntlDateFormatter constructor documentation
On GitHub:  https://github.com/php/doc-en/pull/1086
Patch:      https://github.com/php/doc-en/pull/1086.patch
 [2021-11-12 09:28 UTC] nikic@php.net
-Type: Bug +Type: Documentation Problem
 [2021-11-12 09:28 UTC] nikic@php.net
Closing as https://github.com/php/doc-en/pull/1086 has been merged.
 [2021-11-12 09:42 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 17 12:05:45 2022 UTC