BrowserDetector::__construct()
uses the following code.
if ($userAgent != '') {
// Set the user agent.
$this->setUserAgent($userAgent);
$this->dd->setUserAgent($userAgent);
// We can parse the information.
$this->dd->parse();
}
The code in BrowserDetector::setUserAgent()
is the following one.
$this->userAgent = $userAgent;
$this->dd->setUserAgent($userAgent);
// We can parse the information.
$this->dd->parse();
Since the constructor calls BrowserDetector::setUserAgent()
, it doesn't need to call $this->dd->setUserAgent($userAgent)
and $this->dd->parse()
, as that is already done from BrowserDetector::setUserAgent()
. The constructor should simply use the following code.
public function __construct($userAgent = '') {
// Initiate the DeviceDetector library.
$this->dd = new DeviceDetector();
$this->dd->discardBotInformation();
$this->dd->skipBotDetection();
if ($userAgent != '') {
// Set the user agent.
$this->setUserAgent($userAgent);
}
}
Needs work
2.1
Code
It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.
The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.