Doc #65163 [Asn->Csd]: Collator::__construct inconsistency between doc and implementation

From: Date: Sun, 08 Jun 2014 23:24:34 +0000
Subject: Doc #65163 [Asn->Csd]: Collator::__construct inconsistency between doc and implementation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11268@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65163&edit=1 ID: 65163 Updated by: stas@php.net Reported by: poinsot dot julien at gmail dot co Summary: Collator::__construct inconsistency between doc and implementation -Status: Assigned +Status: Closed Type: Documentation Problem Package: I18N and L10N related PHP Version: Irrelevant Assigned To: stas Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2014-06-08 23:24:14] stas@php.net Automatic comment from SVN on behalf of stas Revision: http://svn.php.net/viewvc/?view=revision&revision=333736 Log: Fix bug #65163: match the docs to the code ------------------------------------------------------------------------ [2014-06-08 23:06:05] stas@php.net I think, given how long it has been the case, and that all other classes see "" and null as the same, it's better to fix the docs to state "" and null are the same and "root" is UCA rules. This would not remove any functionality - "root" still works - but would make intl more consistent. ------------------------------------------------------------------------ [2013-06-28 21:13:04] poinsot dot julien at gmail dot co Description: ------------ There is an inconsistency between current PHP implemention and the documentation about Collator::__construct, Collator::create and collator_create. It says: Special values for locales can be passed in - if null is passed for the locale, the default locale collation rules will be used. If empty string ("") or "root" are passed, UCA rules will be used. But actual implementation of collator_ctor in ext/intl/collator/collator_create.c does not check type of its parameter: if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s", &locale, &locale_len ) == FAILURE ) /* ... */ if(locale_len == 0) { locale = intl_locale_get_default(TSRMLS_C); } So, for PHP, a NULL value as an empty string imply the default locale. Test script: --------------- ini_set('intl.default_locale', fr_CA); $coll = new Collator(''); var_dump( $coll->getLocale(Locale::VALID_LOCALE) ); Expected result: ---------------- string(4) "root" Actual result: -------------- string(5) "fr_FR" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65163&edit=1

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