Skip to content

Windows 8 version_compare #5794

@etienne-martin

Description

@etienne-martin

I think there's an issue with the following if statement found in /DeviceDetector.php:

The comment says that any device with the Touch fragment running Windows 8 or later should be detected as a tablet:

/**
 * According to http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
 * Internet Explorer 10 introduces the "Touch" UA string token. If this token is present at the end of the
 * UA string, the computer has touch capability, and is running Windows 8 (or later).
 * This UA string will be transmitted on a touch-enabled system running Windows 8 (RT)
 *
 * As most touch enabled devices are tablets and only a smaller part are desktops/notebooks we assume that
 * all Windows 8 touch devices are tablets.
 */

if (is_null($this->device) && ($osShortName == 'WRT' || ($osShortName == 'WIN' && version_compare($osVersion, '8.0'))) && $this->isTouchEnabled()) {
    $this->device = DeviceParserAbstract::DEVICE_TYPE_TABLET;
}

Executing version_compare('8.0', '8.0') returns 0, which is falsy. So in the end the if statement will only be true when the $osVersion is 8.1 or greater.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions