Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit c2f2bfe

Browse files
committed
Fixes zendframework#550 - Zend_Http_UserAgent_AbstractDevice undefined index
1 parent 41009ad commit c2f2bfe

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

library/Zend/Http/UserAgent/AbstractDevice.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,9 @@ public static function extractFromUserAgent($userAgent)
509509
}
510510
$result['browser_version'] = '??';
511511
}
512-
} elseif ($product == 'mozilla' && $result['browser_version'] < 5.0) {
512+
} elseif ($product == 'mozilla' && isset($result['browser_version'])
513+
&& $result['browser_version'] < 5.0
514+
) {
513515
// handles the real Mozilla (or old Netscape if version < 5.0)
514516
$result['browser_name'] = 'Netscape';
515517
}

tests/Zend/Http/UserAgent/AbstractDeviceTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10128,4 +10128,14 @@ public function testOperaOnHtcHd2UserAgentShouldNotResultInNotices()
1012810128
$capabilities = Zend_Http_UserAgent_AbstractDevice::extractFromUserAgent($userAgent);
1012910129
$this->assertEquals('Opera', $capabilities['browser_name']);
1013010130
}
10131+
10132+
/**
10133+
* @group GH-550
10134+
*/
10135+
public function testOnlyBrowserNameShouldNotResultInNotices()
10136+
{
10137+
$userAgent = 'Mozilla';
10138+
$capabilities = Zend_Http_UserAgent_AbstractDevice::extractFromUserAgent($userAgent);
10139+
$this->assertEquals('Mozilla', $capabilities['browser_name']);
10140+
}
1013110141
}

0 commit comments

Comments
 (0)