implement FR #54540 - Allow loading of arbitrary resource bundles when fallback is disabled

This commit is contained in:
Stanislav Malyshev committed 2011-04-17 21:56:26 +00:00
1 parent 1b6dd18082
commit 339f46237d
4 files changed
+29 -2

No files matched your search

+4
View File
@@ -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");
+1 -1
View File
@@ -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
@@ -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)