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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC