mirror of
https://github.com/php/php-src.git
synced 2026-03-26 01:02:25 +01:00
implement FR #54540 - Allow loading of arbitrary resource bundles when fallback is disabled
This commit is contained in:
4
NEWS
4
NEWS
@@ -42,6 +42,10 @@ PHP NEWS
|
||||
- Filter extension:
|
||||
. Fixed bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented). (Ilia)
|
||||
|
||||
- intl extension:
|
||||
. Implemented FR #54540 (Allow loading of arbitrary resource bundles when
|
||||
fallback is disabled). (David Zuelke, Stas)
|
||||
|
||||
- LDAP extension:
|
||||
. Fixed bug #53339 (Fails to build when compilng with gcc 4.5 and DSO
|
||||
libraries). (Clint Byrum, Raphael)
|
||||
|
||||
@@ -102,7 +102,11 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
|
||||
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
|
||||
|
||||
rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
|
||||
if (fallback) {
|
||||
rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
|
||||
} else {
|
||||
rb->me = ures_openDirect(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
|
||||
}
|
||||
|
||||
INTL_CTOR_CHECK_STATUS(rb, "resourcebundle_ctor: Cannot load libICU resource bundle");
|
||||
|
||||
|
||||
@@ -57,6 +57,6 @@ ResourceBundle Object
|
||||
|
||||
-127: U_USING_DEFAULT_WARNING
|
||||
NULL
|
||||
-127: resourcebundle_ctor: Cannot load libICU resource '%s/resourcebundle' without fallback from en_US to root: U_USING_DEFAULT_WARNING
|
||||
2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
|
||||
NULL
|
||||
2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
|
||||
|
||||
19
ext/intl/tests/resourcebundle_internal.phpt
Normal file
19
ext/intl/tests/resourcebundle_internal.phpt
Normal file
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Test ResourceBundle::__construct() with internal ICU bundles
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$b = new ResourceBundle('de_DE', 'ICUDATA-region');
|
||||
var_dump($b->get('Countries')->get('DE'));
|
||||
|
||||
$b = new ResourceBundle('icuver', 'ICUDATA');
|
||||
var_dump($b->get('ICUVersion') !== NULL);
|
||||
|
||||
$b = new ResourceBundle('supplementalData', 'ICUDATA', false);
|
||||
var_dump($b->get('cldrVersion') !== NULL);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(11) "Deutschland"
|
||||
bool(true)
|
||||
bool(true)
|
||||
Reference in New Issue
Block a user