String function warming from isValidHost(null) called after update in Matomo 4.8.0-rc1 on PHP 8.1 #18885
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.
Milestone
Expected Behavior
There are no notice boxes on the Matomo dashboard.
Current Behavior
Two errors are reported as orange message boxes on the dashboard just after update:
Possible Solution
The code in question is within
public static function isValidHost($host = false)
:It occurs to me that there is no code prior to this that would be triggered by 'null'. Passing null does not trigger use of the default value. As PHP type comparisons show, they are not the same - false is 'not true', null means it is not initialized.
Perhaps the code could guard against this by adding a test for null to the block with the condition
if ($host === false) {
earlier on, that triesself::getHostFromServerVariable()
instead, and failing that returns true.Steps to Reproduce (for Bugs)
I ran
service php8.1-fpm restart
but I cannot be sure whether I did that before or after seeing the warning.In case it matters: this server is processing proxy_passed from another server.
On the recieving processing server, the nginx config is:
On the sending server:
Your Environment
The text was updated successfully, but these errors were encountered: