-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
$dd->getDeviceName() empty #7829
Comments
HI @jcerdan! This is indeed the Facebook app running on iPhone 14 Pro, and is a human interaction. In this case, device should have been a -
user_agent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]'
os:
name: iOS
version: 17.6.1
platform: ""
client:
type: mobile app
name: Facebook
version: 479.1.0.33.109
device:
type: phablet
brand: Apple
model: iPhone 14 Pro
os_family: iOS
browser_family: Unknown |
Hi @liviuconcioiu , I'm running version 6.4.0. and I get
How do you get the info for device=phablet? |
There's a bug on the website (user agent is wrongly encoded), reported in Findus23/devicedetector.net#4. If you use the php code, detection works. <?php
include_once 'path/to/spyc/Spyc.php';
include_once 'path/to/device-detector/autoload.php';
use DeviceDetector\ClientHints;
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\AbstractDeviceParser;
AbstractDeviceParser::setVersionTruncation(AbstractDeviceParser::VERSION_TRUNCATION_NONE);
$userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]';
$result = DeviceDetector::getInfoFromUserAgent($userAgent);
echo Spyc::YAMLDump($result, 2, 0); |
I have checked commits. Looks like iOS improvement detection has been added after 6.4.0 release. |
Hi, So this code returns a null value:
while the same without ClientHints return the correct device name. Is that a bug? |
Yes, it is a bug. It was introduced in #7807. @sanchezzzhak can you look again at the code when you have time? <?php
include_once 'path/to/spyc/Spyc.php';
include_once 'path/to/device-detector/autoload.php';
use DeviceDetector\ClientHints;
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\AbstractDeviceParser;
AbstractDeviceParser::setVersionTruncation(AbstractDeviceParser::VERSION_TRUNCATION_NONE);
$userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]';
$clientHints = ClientHints::factory([]);
$result = DeviceDetector::getInfoFromUserAgent($userAgent, $clientHints);
echo Spyc::YAMLDump($result, 2, 0); This test should return ---
user_agent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]'
os:
name: iOS
version: 17.6.1
platform: ""
client:
type: mobile app
name: Facebook
version: 479.1.0.33.109
device:
type: phablet
brand: Apple
model: iPhone 14 Pro
os_family: iOS
browser_family: Unknown and not ---
user_agent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]'
os:
name: iOS
version: 17.6.1
platform: ""
client:
type: mobile app
name: Facebook
version: 479.1.0.33.109
device:
type: ""
brand: Apple
model: ""
os_family: iOS
browser_family: Unknown |
@jcerdan you can check with my change, if you need it working right away, until the commit is merged. Also, fyi you need to request the headers from browser like this, if you want to fully benefit from client hints detection. Some browsers don't send full headers, if aren't requsted. <?php
header('Accept-CH: Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Arch, Sec-CH-UA-Model, Sec-CH-UA-Form-Factors, Sec-CH-UA-Bitness, Sec-CH-UA-WoW64');
...code... |
* Fix client hints bug ref #7829
Hello,
sometimes $dd->getDeviceName() returns an empty string.
DD detects it's not a bot, but device is empty.
What does that mean? Is it for real a human interaction?
I got the HTTP_USER_AGENT for one of those:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]
Looks like FB app running on an iPhone...
regards
The text was updated successfully, but these errors were encountered: