Skip to content
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

Cast column label to string to stop magic casting issues. #21366

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

caddoo
Copy link
Contributor

@caddoo caddoo commented Oct 5, 2023

Description:

Labels can be anything, and PHP likes trying to cast itself. ( see https://3v4l.org/X6v6E#v8.1.24 )

This causes errors, and we can safely assume the key for the array should always be a string.

I didn't modify Row.getColumn's response type or cast within there as there is a lot of code that depends on that and the change would be riskier.

Fixes: #21357

Review

@caddoo caddoo added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Oct 5, 2023
@caddoo caddoo marked this pull request as ready for review October 5, 2023 02:25
@caddoo caddoo requested a review from a team October 5, 2023 02:34
michalkleiner
michalkleiner previously approved these changes Oct 5, 2023
Copy link
Contributor

@michalkleiner michalkleiner left a comment

Choose a reason for hiding this comment

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

Looks ok to me on its own, the failing tests seem to be unrelated, so I'd say good to go for 4.x

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

This doesn't look complete to me. You have only changed the place where rowsIndexByLabel is filled, but all places where that array is used to find entries are untouched. This will have the effect, that keys won't be found anymore. Methods like getRowIdFromLabel imho also needs to be adjusted.

@sgiehl sgiehl dismissed michalkleiner’s stale review October 6, 2023 13:17

additional changes required

@caddoo caddoo requested a review from sgiehl October 8, 2023 21:11
@sgiehl sgiehl added this to the 4.15.2 milestone Oct 9, 2023
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Looks good now. Before merging this one, we should ensure that there already is a PR for 5.x-dev, so re don't forget to apply the changes there as well.

@caddoo
Copy link
Contributor Author

caddoo commented Oct 11, 2023

Looks good now. Before merging this one, we should ensure that there already is a PR for 5.x-dev, so re don't forget to apply the changes there as well.

Good point, here it is #21393

@sgiehl sgiehl merged commit be663ef into 4.x-dev Oct 11, 2023
17 of 21 checks passed
@sgiehl sgiehl deleted the dev-17257-cast-column-label-to-string branch October 11, 2023 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants