Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

Incorrectly Identifying OS X 10.10 - Yosemite

It looks like mint (specifically useragent007) is incorrectly identifying OS X 10.10 as 10.1. When I look at my stats, I’m starting to see a bunch of hits from OS X Puma. These didn’t show up until Yosemite was released.

I’m sure it has something to do with this regex, but I’m not a real expert at that:

if (preg_match(‘#Mac OS X (10[^;]+)#i’, $user_agent, $m))

rpetges
Minted
Posted on Dec 13, '14 at 05:00 pm

I changed the whole RegEx ass follows :

if (pregmatch(‘/10[0-9]+/’, $useragent, $m)) { $build = strreplace(‘_’, ‘.’, $m[0]); $builds = array ( ‘10.0’ => ‘Cheetah’, ‘10.1’ => ‘Puma’, ‘10.2’ => ‘Jaguar’, ‘10.3’ => ‘Panther’, ‘10.4’ => ‘Tiger’, ‘10.5’ => ‘Leopard’, ‘10.6’ => ‘Snow Leopard’, ‘10.7’ => ‘Lion’, ‘10.8’ => ‘Mountain Lion’, ‘10.9’ => ‘Mavericks’, ‘10.10’ => ‘Yosemite’

        );

……

I use https://regex101.com to test RegEx expressions.

Taking your code above, here is what I did:

if (preg_match(/10[0-9]+/, $user_agent, $m)) { $build = str_replace(_, ., $m[0]); $builds = array ( ‘10.0’ => ‘Cheetah’, ‘10.1’ => ‘Puma’, ‘10.2’ => ‘Jaguar’, ‘10.3’ => ‘Panther’, ‘10.4’ => ‘Tiger’, ‘10.5’ => ‘Leopard’, ‘10.6’ => ‘Snow Leopard’, ‘10.7’ => ‘Lion’, ‘10.8’ => ‘Mountain Lion’, ‘10.9’ => ‘Mavericks’, ‘10.10’ => ‘Yosemite’ );

When I do that, Mint no longer even renders properly. So I’m obviously doing something wrong.

rpetges
Minted
Posted on Dec 18, '14 at 04:51 pm

I try to correctly post code with formatting, but whatever I try the code gets messed :-(

Please visit my site at petges.lu and send me a message using the Contact form.

This should fix it:

if (preg_match('#Mac OS X (10[^;]+)#i', $user_agent, $m))
{
    $build = rtrim(substr(str_replace('_', '.', $m[1]), 0, 5), '.');
    $builds = array
    (
        '10.0' => 'Cheetah',
        '10.1' => 'Puma',
        '10.2' => 'Jaguar',
        '10.3' => 'Panther',
        '10.4' => 'Tiger',
        '10.5' => 'Leopard',
        '10.6' => 'Snow Leopard',
        '10.7' => 'Lion',
        '10.8' => 'Mountain Lion',
        '10.9' => 'Mavericks',
        '10.10' => 'Yosemite',
        '10.11' => 'El Capitan'
    );

You must be logged in to reply. Login above or create an account

Hey there, I have officially suspended sales and support of Mint. The Create Account, Add License, Transfer License, and Contact forms have been disabled. Existing customers may continue to login and download Mint.

More info Continue