Skip to content

Commit 67770dc

Browse files
authored
Resolves Undefined index: HTTP_USER_AGENT mikehaertl#11
mikehaertl#11
1 parent d237c97 commit 67770dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/File.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ public function send($filename = null, $contentType, $inline = false)
7878
header('Content-Type: '.$contentType);
7979
header('Content-Transfer-Encoding: binary');
8080

81+
//#11 Undefined index: HTTP_USER_AGENT
82+
$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
83+
8184
// #84: Content-Length leads to "network connection was lost" on iOS
82-
$isIOS = preg_match('/i(phone|pad|pod)/i', $_SERVER['HTTP_USER_AGENT']);
85+
$isIOS = preg_match('/i(phone|pad|pod)/i', $userAgent);
8386
if (!$isIOS) {
8487
header('Content-Length: ' . filesize($this->_fileName));
8588
}

0 commit comments

Comments
 (0)