Closed JanMikes closed 3 years ago
I checked the failing job but i do not know what is wrong, i think it is not related to my changes: https://travis-ci.org/github/serbanghita/Mobile-Detect/jobs/664801215?utm_medium=notification&utm_source=github_status
Hi! Have the same issue in my project. I think best fix is just "if (null !== $matchType)" instead of this line. Bc $matchType can be only null or array('matches' => ...) for now.
In your fix we have 2 checks. But second (is_array($matchType['matches']) have no sense bc if (isset($matchType['matches'])) then it's array.
Thank you, I reproduced this:
$detect = new Mobile_Detect;
$detect->setHttpHeaders(array(
'HTTP_X_WAP_PROFILE' => '',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 4.1.1; cs-cz; HUAWEI G510-0200 Build/HuaweiG510-0200) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
));
$ php74 -f examples/test.php
PHP Notice: Trying to access array offset on value of type null in D:\webserver\www\git\Mobile-Detect\Mobile_Detect.php on line 1056
Notice: Trying to access array offset on value of type null in D:\webserver\www\git\Mobile-Detect\Mobile_Detect.php on line 1056
Fixes #829