serbanghita / Mobile-Detect

Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
http://mobiledetect.net
MIT License
10.52k stars 2.67k forks source link

Restore implicit use of `HTTP_USER_AGENT` in 4.8.x branch #941

Closed ADmad closed 11 months ago

ADmad commented 11 months ago

4.8 removed the automatic use of $_SERVER['HTTP_USER_AGENT'] and requires one to explicitly set the User-Agent string.

This hinders usability IMHO as in majority of the use case that's the value users will have to get explicitly.

So I suggest re-introducing the implicit use of $_SERVER['HTTP_USER_AGENT'] if the User-Agent string is not explicit set.

serbanghita commented 11 months ago

@ADmad taking a look today at this, probably I forgot this code + tests

serbanghita commented 11 months ago

I checked and forgot to put the fallback to setHttpHeaders which sets the userAgent from HTTP headers. Will provide a patch after work. 👍 🙇

serbanghita commented 11 months ago

@ADmad done in https://github.com/serbanghita/Mobile-Detect/releases/tag/4.8.03 thanks a lot for the input!