Doc #68066 [Opn]: blank locale in IntlDateFormatter::formatObject return international format

From: Date: Sun, 08 Apr 2018 17:27:21 +0000
Subject: Doc #68066 [Opn]: blank locale in IntlDateFormatter::formatObject return international format
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15593@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68066&edit=1 ID: 68066 Updated by: cmb@php.net Reported by: dgoosens at gmail dot com Summary: blank locale in IntlDateFormatter::formatObject return international format Status: Open Type: Documentation Problem Package: I18N and L10N related Operating System: Ubuntu 14.04 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: If a string is passed as $locale, it is passed along unmodified to Locale::createFromName(). However, the documentation for this method does not specify what happens if an empty string is passed. Previous Comments: ------------------------------------------------------------------------ [2014-09-20 23:14:42] dgoosens at gmail dot com Description: ------------ when passing a blank space instead of NULL or a valid locale, the \IntlDateFormatter::formatObject returns an international formatted string... I'm thinking this is the apropriate behavior but it is not documented... Documentation states : [http://be2.php.net/manual/en/intldateformatter.formatobject.php] locale The locale to use, or NULL to use the default one. Test script: --------------- <?php $dateTime = new \DateTime(); echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::NONE, null); echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::NONE, ''); echo PHP_EOL; echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::SHORT, null); echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::SHORT, ''); echo PHP_EOL; echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::MEDIUM, null); echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::MEDIUM, ''); echo PHP_EOL; echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::LONG, null); echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::LONG, ''); echo PHP_EOL; echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::FULL, null); echo PHP_EOL; echo \IntlDateFormatter::formatObject($dateTime, \IntlDateFormatter::FULL, ''); Expected result: ---------------- Either the script should throw a warning or the documentation needs an update to illustrate the actual behavior Actual result: -------------- 20140921 01:04 AM 20140921 01:04 AM 9/21/14, 1:04 AM 2014-09-21 01:04 Sep 21, 2014, 1:04:40 AM 2014 M09 21 01:04:40 September 21, 2014 at 1:04:40 AM GMT+2 2014 M09 21 01:04:40 GMT+2 Sunday, September 21, 2014 at 1:04:40 AM Central European Summer Time 2014 M09 21, Sun 01:04:40 GMT+02:00 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68066&edit=1

« previous php.doc.bugs (#15593) next »