browscap / browscap-php

Officially supported Browscap for PHP
http://browscap.org/
MIT License
422 stars 82 forks source link

Inconsistent BrowscapPHP::getBrowser() property types #212

Closed holtkamp closed 7 years ago

holtkamp commented 7 years ago

When using the default formatter and invoking [https://github.com/browscap/browscap-php/blob/41d47ba71806dc059f2b8e3cc4ff94e4f1df399c/src/Browscap.php#L192]($browscap->getBrowser()] an object of type stdClass is returned, which has some properties defined.

The types of these properties seem not all parsed to a primary type. For example:

A lot of boolean values are returned as string. Is this on purpose?

A full listing:

object(stdClass)#10151 (50) {
  ["browser_name_regex"] => string(59) "/^mozilla\/5\.0 \(.*mac os x.*\) gecko.* firefox\/53\.0.*$/"
  ["browser_name_pattern"] => string(45) "mozilla/5.0 (*mac os x*) gecko* firefox/53.0*"
  ["parent"] => string(12) "Firefox 53.0"
  ["comment"] => string(12) "Firefox 53.0"
  ["browser"] => string(7) "Firefox"
  ["browser_type"] => string(7) "unknown"
  ["browser_bits"] => string(1) "0"
  ["browser_maker"] => string(7) "unknown"
  ["browser_modus"] => string(7) "unknown"
  ["version"] => string(4) "53.0"
  ["majorver"] => string(1) "0"
  ["minorver"] => string(1) "0"
  ["platform"] => string(6) "MacOSX"
  ["platform_version"] => string(7) "unknown"
  ["platform_description"] => string(7) "unknown"
  ["platform_bits"] => string(1) "0"
  ["platform_maker"] => string(7) "unknown"
  ["alpha"] => string(5) "false"
  ["beta"] => string(5) "false"
  ["win16"] => string(5) "false"
  ["win32"] => string(5) "false"
  ["win64"] => string(5) "false"
  ["frames"] => string(5) "false"
  ["iframes"] => string(5) "false"
  ["tables"] => string(5) "false"
  ["cookies"] => string(5) "false"
  ["backgroundsounds"] => string(5) "false"
  ["javascript"] => string(5) "false"
  ["vbscript"] => string(5) "false"
  ["javaapplets"] => string(5) "false"
  ["activexcontrols"] => string(5) "false"
  ["ismobiledevice"] => bool(false)
  ["istablet"] => bool(false)
  ["issyndicationreader"] => string(5) "false"
  ["crawler"] => string(5) "false"
  ["isfake"] => string(5) "false"
  ["isanonymized"] => string(5) "false"
  ["ismodified"] => string(5) "false"
  ["cssversion"] => string(1) "0"
  ["aolversion"] => string(1) "0"
  ["device_name"] => string(7) "unknown"
  ["device_maker"] => string(7) "unknown"
  ["device_type"] => string(7) "Desktop"
  ["device_pointing_method"] => string(7) "unknown"
  ["device_code_name"] => string(7) "unknown"
  ["device_brand_name"] => string(7) "unknown"
  ["renderingengine_name"] => string(7) "unknown"
  ["renderingengine_version"] => string(7) "unknown"
  ["renderingengine_description"] => string(7) "unknown"
  ["renderingengine_maker"] => string(7) "unknown"
}
mimmi20 commented 7 years ago

@holtkamp Could you add the useragent which you used?