-
Notifications
You must be signed in to change notification settings - Fork 8k
Declare Transliterator::$id as readonly to unlock subclassing it #9167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9f1e051 to
c5a8c69
Compare
cmb69
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transliterator should better have been final, but that ship has sailed, so this looks like a good idea to mitigate the BC break.
@kocsismate, thoughts?
c5a8c69 to
9796b2a
Compare
|
@cmb69 thanks for the review. Could you please help me on the failure? |
|
The problem: php-src/ext/intl/transliterator/transliterator_class.c Lines 143 to 157 in 520bb2e
In the first line the properties are cloned (so I guess we can do something like: ext/intl/transliterator/transliterator_class.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index 2dbc940f37..3610b03d84 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -152,9 +152,7 @@ static zend_object *Transliterator_clone_obj( zend_object *object )
if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to_orig ) ) )
goto err;
- ZVAL_OBJ(&tempz, ret_val);
- transliterator_object_construct( &tempz, utrans,
- TRANSLITERATOR_ERROR_CODE_P( to_orig ) );
+ to_new->utrans = utrans;
if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to_orig ) ) )
{(and do some cleanup regarding the error handling) |
9796b2a to
74e84af
Compare
That worked thanks! (and that makes sense)
not sure what you mean here :) |
74e84af to
e520fb7
Compare
e520fb7 to
dcf0aed
Compare
Codecov Report
@@ Coverage Diff @@
## master #9167 +/- ##
=======================================
Coverage 67.12% 67.12%
=======================================
Files 841 841
Lines 311272 311272
=======================================
Hits 208936 208936
Misses 102336 102336 📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
This PR was merged into the 6.2 branch. Discussion ---------- [Intl] Fix EmojiTransliterator on PHP 8.2 | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Requires php/php-src#9167 Commits ------- c1df6da [Intl] Fix EmojiTransliterator on PHP 8.2
cmb69
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks right now. Thank you!
I'm leaving this open for a while, so that others can review.
Girgias
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dcf0aed to
ab64c94
Compare
ab64c94 to
b871bef
Compare
This PR was merged into the 6.2 branch. Discussion ---------- [Intl] Remove unused code in tests | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Added in #47083 but not needed anymore since php/php-src#9167 Commits ------- ca143fc [Intl] Remove dead code in tests
Before PHP 8.2 it was possible to create a child translator with a custom
$idby usingunserialize():But since #7945, this doesn't work anymore, causing a BC break with no alternative.
Yet, there is a way to make this work in 8.2, which is to remove the custom code that makes $id read-only and replacing it with a native
readonlydeclaration.So here we are, see test case also.