Skip to content

Commit 05d1680

Browse files
committed
Fixed bug #80644: ResourceBundle::get() doesn't reset error state
1 parent 1bdd8f7 commit 05d1680

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ PHP NEWS
3333
. Fixed bug #80560 (Strings containing only a base prefix return 0 object).
3434
(girgias)
3535

36+
- Intl:
37+
. Fixed bug #80644 (Missing resource causes subsequent get() calls to fail).
38+
(Nikita)
39+
3640
- MySQLi:
3741
. Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
3842
interpret bit columns). (Nikita)

ext/intl/resourcebundle/resourcebundle_class.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ static void resourcebundle_array_fetch(zend_object *object, zval *offset, zval *
171171
char *pbuf;
172172
ResourceBundle_object *rb;
173173

174-
intl_error_reset( NULL );
175174
rb = php_intl_resourcebundle_fetch_object(object);
175+
intl_error_reset(NULL);
176+
intl_error_reset(INTL_DATA_ERROR_P(rb));
176177

177178
if(Z_TYPE_P(offset) == IS_LONG) {
178179
is_numeric = 1;

ext/intl/tests/resourcebundle_individual.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ function ut_main() {
2828
$t = ut_resourcebundle_get( $r, 'nonexisting' );
2929
$str_res .= debug( $t );
3030

31+
// Make sure accessing existing after non-existing works.
32+
$t = ut_resourcebundle_get( $r, 'teststring' );
33+
$str_res .= debug( $t );
34+
3135
return $str_res;
3236
}
3337
include_once( 'ut_common.inc' );
@@ -55,3 +59,5 @@ testtable: 3
5559
testarray: string 3
5660
NULL
5761
2: Cannot load resource element 'nonexisting': U_MISSING_RESOURCE_ERROR
62+
Hello World!
63+
0: U_ZERO_ERROR

0 commit comments

Comments
 (0)