{"action":"created","issue":{"url":"https://api.github.com/repos/3rd-Eden/useragent/issues/63","labels_url":"https://api.github.com/repos/3rd-Eden/useragent/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/3rd-Eden/useragent/issues/63/comments","events_url":"https://api.github.com/repos/3rd-Eden/useragent/issues/63/events","html_url":"https://github.com/3rd-Eden/useragent/issues/63","id":56646471,"number":63,"title":"Broken device.family results since 2.1.4","user":{"login":"steve-p-com","id":5180548,"avatar_url":"https://avatars.githubusercontent.com/u/5180548?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-p-com","html_url":"https://github.com/steve-p-com","followers_url":"https://api.github.com/users/steve-p-com/followers","following_url":"https://api.github.com/users/steve-p-com/following{/other_user}","gists_url":"https://api.github.com/users/steve-p-com/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-p-com/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-p-com/subscriptions","organizations_url":"https://api.github.com/users/steve-p-com/orgs","repos_url":"https://api.github.com/users/steve-p-com/repos","events_url":"https://api.github.com/users/steve-p-com/events{/privacy}","received_events_url":"https://api.github.com/users/steve-p-com/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-05T09:31:14Z","updated_at":"2015-02-05T12:37:04Z","closed_at":null,"body":"I have two versions of my production server. Most are still on version 2.1.3, but one I built recently has 2.1.4. On this 2.1.4 server, there are some weird device.family results appearing in my logs. For example:\r\n\r\n```\r\nSamsung $2\r\nZiiLABS $2\r\nPrestigio PMP3970B $2\r\nLenovo IdeaTab $2\r\nSamsung undefined$2\r\nSamsung SAMSUNG $2\r\nLG-$2\r\nHTC One $2 $3 $4\r\nHTC Desire $2 $3 $4\r\nNokia$2$3\r\nYifang GE$2$3\r\nHTC WildfireS $2 $3 $4\r\n```\r\n\r\nPicking the top one as an example, the user agent is\r\n\r\n```\r\nMozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T230 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36\r\n```\r\n\r\nUsing 2.1.3, device.family is correct: `Samsung SM-T230`\r\nUsing 2.1.4, device.family is incorrect: `Samsung $2`\r\n\r\n90% of devices are OK. These broken ones represent around 10% of the different devices in my logs. I have not noticed any similar issues with browser or operating system. It just looks like device that's a bit broken.\r\n\r\nI'm going to force 2.1.3 for the moment on my servers, but hopefully this can be fixed going forward :-)"},"comment":{"url":"https://api.github.com/repos/3rd-Eden/useragent/issues/comments/73039438","html_url":"https://github.com/3rd-Eden/useragent/issues/63#issuecomment-73039438","issue_url":"https://api.github.com/repos/3rd-Eden/useragent/issues/63","id":73039438,"user":{"login":"steve-p-com","id":5180548,"avatar_url":"https://avatars.githubusercontent.com/u/5180548?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-p-com","html_url":"https://github.com/steve-p-com","followers_url":"https://api.github.com/users/steve-p-com/followers","following_url":"https://api.github.com/users/steve-p-com/following{/other_user}","gists_url":"https://api.github.com/users/steve-p-com/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-p-com/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-p-com/subscriptions","organizations_url":"https://api.github.com/users/steve-p-com/orgs","repos_url":"https://api.github.com/users/steve-p-com/repos","events_url":"https://api.github.com/users/steve-p-com/events{/privacy}","received_events_url":"https://api.github.com/users/steve-p-com/received_events","type":"User","site_admin":false},"created_at":"2015-02-05T12:37:04Z","updated_at":"2015-02-05T12:37:04Z","body":"Here's a test program which (on my linux 2.1.4 server) goes wrong every time:\r\n\r\n```\r\nvar useragent = require('useragent');\r\n\r\nfunction testArray(agents) {\r\n    // test an array of user agent strings\r\n    var i,\r\n        parsed,\r\n        okcount = 0,\r\n        errcount = 0;\r\n\r\n    console.log('testing %d unique user agent strings', agents.length);\r\n\r\n    for (i = 0; i < agents.length; i += 1) {\r\n        parsed = useragent.parse(agents[i]);\r\n\r\n        if (parsed.device.family.indexOf('$') !== -1 || parsed.device.family.indexOf('undefined') !== -1) {\r\n            console.log('User agent: %s', agents[i]);\r\n            console.log('device.family: %s', parsed.device.family);\r\n            errcount += 1;\r\n        } else {\r\n            okcount += 1;\r\n        }\r\n\r\n    }\r\n\r\n    console.log('success: %d', okcount);\r\n    console.log('failure: %d', errcount);\r\n}\r\n\r\nvar agents = [];\r\n\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.02.04) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T230 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.00.13-FROYO) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9295 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; LG-D802 Build/KOT49I.D80220d) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9505/I9505XXUGNJ5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.4; en-gb; SAMSUNG SM-G901F Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG SM-N910C Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.2.2; IdeaTab A3000-F Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 5.0.1; HTC One_M8 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.4; HTC_One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.4; HTC One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; HTC_One_E8 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');\r\nagents.push('Mozilla/5.0 (Linux; U; Android 4.1; en-gb; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30@-@524254924');\r\n\r\ntestArray(agents);\r\n```\r\n\r\nSample output:\r\n\r\n```\r\ntesting 27 unique user agent strings\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.02.04) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16\r\ndevice.family: ZiiLABS $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T230 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.00.13-FROYO) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16\r\ndevice.family: ZiiLABS $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9295 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30\r\ndevice.family: Prestigio PMP3970B $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30\r\ndevice.family: Prestigio PMP3970B $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; LG-D802 Build/KOT49I.D80220d) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36\r\ndevice.family: LG-$2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9505/I9505XXUGNJ5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung SAMSUNG $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.4; en-gb; SAMSUNG SM-G901F Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG SM-N910C Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.2.2; IdeaTab A3000-F Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Safari/537.36\r\ndevice.family: Lenovo IdeaTab $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 5.0.1; HTC One_M8 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Mobile Safari/537.36\r\ndevice.family: HTC One $2 $3 $4\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.4; HTC_One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36\r\ndevice.family: HTC One $2 $3 $4\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.4; HTC One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36\r\ndevice.family: HTC One $2 $3 $4\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; HTC_One_E8 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30\r\ndevice.family: HTC One $2 $3 $4\r\nUser agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36\r\ndevice.family: LG-$2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Mobile Safari/537.36\r\ndevice.family: LG-$2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung $2\r\nUser agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36\r\ndevice.family: Samsung SAMSUNG $2\r\nUser agent: Mozilla/5.0 (Linux; U; Android 4.1; en-gb; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30@-@524254924\r\ndevice.family: Samsung undefined$2\r\nsuccess: 0\r\nfailure: 27\r\n```\r\n\r\nHope that helps."}}