Fix the 5.0.11 update on Matomo versions before 5.9 and raise PHPStan to level 5 - #192
Merged
Merged
Conversation
…lease] Clears the eight level-5 findings without changing behaviour: dead empty() checks, 'strlen' filters that return int, and the interface-typed settings backend in the 5.0.11 update.
loadValue()/saveValue() only exist on the settings backend from core 5.9. Check the stored rows with load() and write through the container's settings storage, so 5.1.0 and 5.2.0 in the same run can't write back a stale copy, without SystemSettings::save() starting a cloud IP sync.
snake14
enabled auto-merge (squash)
September 24, 2026 05:39
AltamashShaikh
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the plugin's 5.0.11 update failing on Matomo versions before 5.9. It called settings methods that only exist from Matomo 5.9, so updating the plugin on an older Matomo 5 stopped with an error. The update now uses methods every supported Matomo 5 version has.
The fix edits the existing 5.0.11 update rather than adding a new one: on the affected versions the update fails before completing, and Matomo does not record it as done, so a later update would never be reached, and installs that already ran it are unaffected because it does the same thing. It now also writes through the same settings storage the 5.1.0 and 5.2.0 updates save from, so an install catching up on several updates at once keeps the value, and it does so without starting a cloud IP range sync during the update.
The rest of the change brings the 5.x branch into line with the shared plugin CI setup. The plugin now ships the shared pre-push hook and its created/modified PHPStan configs, and CI checks the hook against the canonical copy (
verify-hook). The base PHPStan level rises from 0 to 5; the remaining findings are cleared without changing behaviour: twoempty()checks that could never be false at that point, and four'strlen'filters replaced with!== ''closures (the values are already trimmed strings).Issue No
PG-4897
Steps to Replicate the Issue
block_headlessvalue stored or configured, update TrackingSpamPrevention from a version before 5.0.11. The new tests inUpdatesTestcover the update, including 5.0.11 followed by 5.1.0 in one run.block_headlessis stored as disabled.Checklist