@diosmosis opened this Pull Request on July 28th 2021 Member

Description:

As title, for summary rows we are currently serializing the row with the incorrect subtable ID, causing it not to load w/ the subtable.

Review

  • [ ] Functional review done
  • [ ] Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • [ ] Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • [ ] Security review done see checklist
  • [ ] Code review done
  • [ ] Tests were added if useful/possible
  • [ ] Reviewed for breaking changes
  • [ ] Developer changelog updated if needed
  • [ ] Documentation added if needed
  • [ ] Existing documentation updated if needed
@diosmosis commented on July 28th 2021 Member

@tsteur from the blame it looks like we were never serializing the summary row. The specific line was last changed seven years ago: https://github.com/matomo-org/matomo/blame/b77e5ff594cdae59862dd4d863220baffc200bec/core/DataTable.php#L1323

And the summaryRow property has been there for nine years. So I think this has always been an issue.

Do you know how this later detects the summary row in methods like addRowsFromSerializedArray where it relied on having the summary row ID?

We serialize the rows array which associates id w/ row data, so we simply unserialize it. The subtable ID after directly unserializing is used to get the subtable in the database. So it detects it because of the ID we serialize it with.

I'm not sure if this answers your questions...

@diosmosis commented on July 29th 2021 Member

@tsteur :+1: that makes sense, to avoid the array operation

@diosmosis commented on July 29th 2021 Member

applied review feedback

This Pull Request was closed on July 30th 2021
Powered by GitHub Issue Mirror