Resolve UConverter callbacks after clone - #23324
Closed
iliaal wants to merge 1 commit into
Closed
Conversation
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;
devnexen
approved these changes
Sep 12, 2026
Member
|
well nvm, I clicked too fast, point not addressed ... |
__construct filled to_cache/from_cache via php_converter_resolve_callback, so a clone, which never runs the constructor, kept both FCCs zeroed and the first callback-worthy convert called zend_call_known_fcc on a NULL handler. Resolve both caches in php_converter_object_ctor so every allocation path gets them.
iliaal
force-pushed
the
fix/intl-uconverter-clone-callback
branch
from
September 12, 2026 22:08
df55043 to
3b51aad
Compare
devnexen
approved these changes
Sep 13, 2026
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 never runs the constructor and only retargeted the ICU C callbacks, so the first callback-worthy convert called zend_call_known_fcc on a NULL handler. Both caches are now resolved in php_converter_object_ctor, covering construct and clone alike.