Doc #81606 [Opn->Csd]: Mistyped IntlDateFormatter::__construct() arguments

[email protected] Fri, 12 Nov 2021 09:42:03 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=81606&edit=1

 ID:                 81606
 Updated by:         [email protected]
 Reported by:        cedric dot anne at gmail dot com
 Summary:            Mistyped IntlDateFormatter::__construct() arguments
-Status:             Open
+Status:             Closed
 Type:               Documentation Problem
 Package:            I18N and L10N related
 Operating System:   Ubuntu
 PHP Version:        8.1.0RC5
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2021-11-12 09:28:51] [email protected]

Closing as https://github.com/php/doc-en/pull/1086 has been merged.

------------------------------------------------------------------------
[2021-11-11 20:59:09] 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-10 20:59:26] 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-10 20:07:24] 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'));




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81606&edit=1