]> granicus.if.org Git - php/commitdiff
Fixed bug #80644: ResourceBundle::get() doesn't reset error state
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 19 Jan 2021 14:20:01 +0000 (15:20 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 19 Jan 2021 14:20:55 +0000 (15:20 +0100)
NEWS
ext/intl/resourcebundle/resourcebundle_class.c
ext/intl/tests/resourcebundle_individual.phpt

diff --git a/NEWS b/NEWS
index aea46517a1985b3991778c1a3929f15c94b81b1d..330d78da75d270b82ac4e99f52f12107474d25e0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,10 @@ PHP                                                                        NEWS
   . Fixed bug #80560 (Strings containing only a base prefix return 0 object).
     (girgias)
 
+- Intl:
+  . Fixed bug #80644 (Missing resource causes subsequent get() calls to fail).
+    (Nikita)
+
 - MySQLi:
   . Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
     interpret bit columns). (Nikita)
index 98a33b928487802ba6f78032623abcf77329033a..fd763dcf37d0144ac4da58632255f597697321d1 100644 (file)
@@ -171,8 +171,9 @@ static void resourcebundle_array_fetch(zend_object *object, zval *offset, zval *
        char         *pbuf;
        ResourceBundle_object *rb;
 
-       intl_error_reset( NULL );
        rb = php_intl_resourcebundle_fetch_object(object);
+       intl_error_reset(NULL);
+       intl_error_reset(INTL_DATA_ERROR_P(rb));
 
        if(Z_TYPE_P(offset) == IS_LONG) {
                is_numeric = 1;
index 46ce239e4d2ad860a2466a6d89c314515ce49ece..46481dc0d61a07a2a045e15255de0eaed3c09e85 100644 (file)
@@ -28,6 +28,10 @@ function ut_main() {
     $t = ut_resourcebundle_get( $r, 'nonexisting' );
     $str_res .= debug( $t );
 
+    // Make sure accessing existing after non-existing works.
+    $t = ut_resourcebundle_get( $r, 'teststring' );
+    $str_res .= debug( $t );
+
     return $str_res;
 }
     include_once( 'ut_common.inc' );
@@ -55,3 +59,5 @@ testtable: 3
 testarray: string 3
 NULL
     2: Cannot load resource element 'nonexisting': U_MISSING_RESOURCE_ERROR
+Hello World!
+    0: U_ZERO_ERROR