Resolve UConverter callbacks after clone - #23324
Open
iliaal wants to merge 1 commit into
Open
Conversation
__construct fills to_cache/from_cache via php_converter_resolve_callback. clone only retargeted the ICU C callbacks, leaving the FCC zeroed, so the first callback-worthy convert called zend_call_known_fcc on a NULL handler. Resolve both caches on the clone.
devnexen
requested changes
Aug 16, 2026
|
|
||
| zend_objects_clone_members(&(objval->obj), &(oldobj->obj)); | ||
|
|
||
| php_converter_resolve_callback(&objval->to_cache, &objval->obj, ZEND_STRL("toUCallback")); |
Member
There was a problem hiding this comment.
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -546,8 +546,6 @@ PHP_METHOD(UConverter, __construct) {
ZEND_ASSERT(EG(exception));
goto cleanup;
}
- php_converter_resolve_callback(&objval->to_cache, Z_OBJ_P(ZEND_THIS), ZEND_STRL("toUCallback"));
- php_converter_resolve_callback(&objval->from_cache, Z_OBJ_P(ZEND_THIS), ZEND_STRL("fromUCallback"));
cleanup:
INTL_G(use_exceptions) = old_use_exception;
INTL_G(error_level) = old_error_level;
@@ -916,6 +914,8 @@ static zend_object *php_converter_object_ctor(zend_class_entry *ce, php_converte
zend_object_std_init(&objval->obj, ce);
object_properties_init(&objval->obj, ce);
intl_error_init(&(objval->error));
+ php_converter_resolve_callback(&objval->to_cache, &objval->obj, ZEND_STRL("toUCallback"));
+ php_converter_resolve_callback(&objval->from_cache, &objval->obj, ZEND_STRL("fromUCallback"));
*pobjval = objval;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UConverter::__construct() fills to_cache/from_cache. clone only retargeted the ICU C callbacks and left those FCCs zeroed, so the first callback-worthy convert called zend_call_known_fcc on a NULL handler. Resolve both caches on the clone.