Skip to content

[Intl] do not access typed property before initialization #58623

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

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Oct 22, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #58600 (comment)
License MIT

@carsonbot carsonbot added this to the 6.4 milestone Oct 22, 2024
@carsonbot carsonbot changed the title [Intl] do not access typed property before initialization [Intl] do not access typed property before initialization Oct 22, 2024
@@ -72,12 +72,12 @@ public function createInverse(): self

public function getErrorCode(): int|false
{
return $this->transliterator?->getErrorCode() ?? 0;
return isset($this->transliterator) ? $this->transliterator->getErrorCode() : 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed? Do the tests fail without the patch? Doesn't the ?? already guard against these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null-coalesce operator doesn't help here when calling a method (that's why this went unnoticed in the linked discussion). The tests are failing without these changes (see also https://3v4l.org/HBV0b).

@xabbuh xabbuh force-pushed the intl-emoji-transliterator branch from f2f7bdb to 3ca2927 Compare October 22, 2024 10:03
@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit f69c9fd into symfony:6.4 Oct 22, 2024
9 of 10 checks passed
@xabbuh xabbuh deleted the intl-emoji-transliterator branch October 22, 2024 10:34
This was referenced Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants