Skip to content

Fix non-countable fatal error in the datatable class #20335

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 2 commits into from
Feb 9, 2023

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Feb 8, 2023

Description:

Fixes #20333

Added checks for all occurrences in the Datatable class where the rows property is counted to first make sure it is actually an array.

Review

@bx80 bx80 added the Bug For errors / faults / flaws / inconsistencies etc. label Feb 8, 2023
@bx80 bx80 added this to the 4.13.4 milestone Feb 8, 2023
@bx80 bx80 self-assigned this Feb 8, 2023
@sgiehl
Copy link
Member

sgiehl commented Feb 8, 2023

@bx80 I think I would have preferred another solution. Instead of always checking if rows is really an array, we could make sure it is an array when property is set. There are currently two places in the class where the property is set/unset. Changing those to ensure the property contains an array afterwards should also fix the issue with less changes I guess.

@bx80
Copy link
Contributor Author

bx80 commented Feb 8, 2023

@sgiehl Yes, that's a much smarter approach 👍

@sgiehl sgiehl force-pushed the m20333-datatable-count-type-fix branch from 1220b99 to 28bd00e Compare February 9, 2023 10:40
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. Will merge it if tests are passing...

@sgiehl sgiehl merged commit fc68f39 into 4.x-dev Feb 9, 2023
@sgiehl sgiehl deleted the m20333-datatable-count-type-fix branch February 9, 2023 13:31
@bx80 bx80 added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Development

Successfully merging this pull request may close these issues.

Fatal error: Argument #1 ($value) must be of type Countable|array, null given in DataTable.php
2 participants