@@ -287,6 +287,14 @@ protected function detectBrowser($userAgent)
287
287
return ;
288
288
}
289
289
290
+ // Check for Google's Private Prefetch Proxy
291
+ if ($ userAgent === 'Chrome Privacy Preserving Prefetch Proxy ' ) {
292
+ // Private Prefetch Proxy does not provide any further details like e.g. version
293
+ $ this ->browser = self ::CHROME ;
294
+
295
+ return ;
296
+ }
297
+
290
298
$ patternBrowser = '' ;
291
299
292
300
// Attempt to detect the browser type. Obviously we are only worried about major browsers.
@@ -394,27 +402,32 @@ protected function detectEngine($userAgent)
394
402
} elseif (\stripos ($ userAgent , 'Edg ' ) !== false ) {
395
403
$ this ->engine = self ::BLINK ;
396
404
} elseif (\stripos ($ userAgent , 'Chrome ' ) !== false ) {
397
- $ result = \explode ('/ ' , \stristr ($ userAgent , 'Chrome ' ));
398
- $ version = \explode (' ' , $ result [1 ]);
405
+ $ this ->engine = self ::BLINK ;
399
406
400
- if ($ version [0 ] >= 28 ) {
401
- $ this ->engine = self ::BLINK ;
402
- } else {
403
- $ this ->engine = self ::WEBKIT ;
407
+ $ result = \explode ('/ ' , \stristr ($ userAgent , 'Chrome ' ));
408
+
409
+ if (isset ($ result [1 ])) {
410
+ $ version = \explode (' ' , $ result [1 ]);
411
+
412
+ if (version_compare ($ version [0 ], '28.0 ' , 'lt ' )) {
413
+ $ this ->engine = self ::WEBKIT ;
414
+ }
404
415
}
405
416
} elseif (\stripos ($ userAgent , 'AppleWebKit ' ) !== false || \stripos ($ userAgent , 'blackberry ' ) !== false ) {
417
+ $ this ->engine = self ::WEBKIT ;
418
+
406
419
if (\stripos ($ userAgent , 'AppleWebKit ' ) !== false ) {
407
- $ result = \explode ('/ ' , \stristr ($ userAgent , 'AppleWebKit ' ));
408
- $ version = \explode (' ' , $ result [1 ]);
420
+ $ result = \explode ('/ ' , \stristr ($ userAgent , 'AppleWebKit ' ));
409
421
410
- if ($ version [0 ] === 537.36 ) {
411
- // AppleWebKit/537.36 is Blink engine specific, exception is Blink emulated IEMobile, Trident or Edge
412
- $ this ->engine = self ::BLINK ;
422
+ if (isset ($ result [1 ])) {
423
+ $ version = \explode (' ' , $ result [1 ]);
424
+
425
+ if ($ version [0 ] === '537.36 ' ) {
426
+ // AppleWebKit/537.36 is Blink engine specific, exception is Blink emulated IEMobile, Trident or Edge
427
+ $ this ->engine = self ::BLINK ;
428
+ }
413
429
}
414
430
}
415
-
416
- // Evidently blackberry uses WebKit and doesn't necessarily report it. Bad RIM.
417
- $ this ->engine = self ::WEBKIT ;
418
431
} elseif (\stripos ($ userAgent , 'Gecko ' ) !== false && \stripos ($ userAgent , 'like Gecko ' ) === false ) {
419
432
// We have to check for like Gecko because some other browsers spoof Gecko.
420
433
$ this ->engine = self ::GECKO ;
0 commit comments