]> granicus.if.org Git - php/commitdiff
Use type-checked ref assignment in UConverter
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Feb 2020 09:21:50 +0000 (10:21 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Feb 2020 09:21:50 +0000 (10:21 +0100)
ext/intl/converter/converter.c

index 8c9377ecae84e6170a15f9c60e8a26cbfa2d167d..49d0d25ecf963268f145a1022e977ca6c0370b41 100644 (file)
@@ -63,9 +63,6 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr
 
 /* {{{ php_converter_default_callback */
 static void php_converter_default_callback(zval *return_value, zval *zobj, zend_long reason, zval *error) {
-       ZVAL_DEREF(error);
-       zval_ptr_dtor(error);
-       ZVAL_LONG(error, U_ZERO_ERROR);
        /* Basic functionality so children can call parent::toUCallback() */
        switch (reason) {
                case UCNV_UNASSIGNED:
@@ -81,7 +78,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, zend_
                                chars[0] = 0x1A;
                                chars[1] = 0;
                                chars_len = 1;
-                ZVAL_LONG(error, U_INVALID_STATE_ERROR);
+                               ZEND_TRY_ASSIGN_REF_LONG(error, U_INVALID_STATE_ERROR);
                 RETVAL_STRINGL(chars, chars_len);
                 return;
             }
@@ -99,8 +96,8 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, zend_
                                chars[0] = 0x1A;
                                chars[1] = 0;
                                chars_len = 1;
-               ZVAL_LONG(error, uerror);
                        }
+                       ZEND_TRY_ASSIGN_REF_LONG(error, uerror);
                        RETVAL_STRINGL(chars, chars_len);
                }
        }