Skip to content

Commit e733207

Browse files
authored
Merge pull request #12 from ahmadasjad/patch-1
Resolves Undefined index: HTTP_USER_AGENT #11
2 parents d237c97 + 67770dc commit e733207

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)