Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2969400
D25868.1739497087.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25868.1739497087.diff
View Options
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -626,20 +626,25 @@
// Try to guess the device resolution based on UA strings to avoid a flash
// of incorrectly-styled content.
$device_guess = 'device-desktop';
- if (preg_match('@iPhone|iPod|(Android.*Chrome/[.0-9]* Mobile)@', $agent)) {
- $device_guess = 'device-phone device';
- } else if (preg_match('@iPad|(Android.*Chrome/)@', $agent)) {
- $device_guess = 'device-tablet device';
+ if (phutil_nonempty_string($agent)) {
+ if (preg_match('@iPhone|iPod|(Android.*Chrome/[.0-9]* Mobile)@',
+ $agent)) {
+ $device_guess = 'device-phone device';
+ } else if (preg_match('@iPad|(Android.*Chrome/)@', $agent)) {
+ $device_guess = 'device-tablet device';
+ }
}
$classes[] = $device_guess;
- if (preg_match('@Windows@', $agent)) {
- $classes[] = 'platform-windows';
- } else if (preg_match('@Macintosh@', $agent)) {
- $classes[] = 'platform-mac';
- } else if (preg_match('@X11@', $agent)) {
- $classes[] = 'platform-linux';
+ if (phutil_nonempty_string($agent)) {
+ if (preg_match('@Windows@', $agent)) {
+ $classes[] = 'platform-windows';
+ } else if (preg_match('@Macintosh@', $agent)) {
+ $classes[] = 'platform-mac';
+ } else if (preg_match('@X11@', $agent)) {
+ $classes[] = 'platform-linux';
+ }
}
if ($this->getRequest()->getStr('__print__')) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 14, 01:38 (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1165138
Default Alt Text
D25868.1739497087.diff (1 KB)
Attached To
Mode
D25868: Fix PHP 8.1 "preg_match(null)" exception for missing User-Agent HTTP Header
Attached
Detach File
Event Timeline
Log In to Comment