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
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: cedric dot anne at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

Pull requests:

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-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 22:01:30 2025 UTC