+ Error on line 664
if (!self::MIN_DESKTOP_VERSIONS[$platform]) {
<?php
namespace cbs\core\lib;
class Platform
{
const PLATFORM_DESKTOP = 'DESKTOP';
const PLATFORM_MOBILE_WEB = 'MOBILE_WEB';
const PLATFORM_TABLET_WEB = 'TABLET_WEB';
const PLATFORM_ROKU = 'ROKU';
const PLATFORM_IPAD = 'IPAD';
const PLATFORM_IOS = 'IOS';
const PLATFORM_ANDROID = 'ANDROID';
const WEB_VIEW_IDENTIFIER = 'CBSWebView';
const PLATFORM_CHROMECAST = "chromecast";
/**
* Browser specific values are required for video api calls
*/
const PLATFORM_DESKTOP_SAFARI = 'desktop_safari';
const PLATFORM_DESKTOP_CHROME = 'desktop_chrome';
const PLATFORM_DESKTOP_IE = 'desktop_internet_explorer';
const PLATFORM_DESKTOP_FIREFOX = 'desktop_firefox';
const PLATFORM_DESKTOP_OPERA = 'desktop_opera';
const PLATFORM_DESKTOP_EDGE = 'desktop_edge';
const PLATFORM_WIN_11 = 'pplus_site_win11pwa';
const MIN_DESKTOP_VERSIONS = [
self::PLATFORM_DESKTOP_CHROME => 68,
self::PLATFORM_DESKTOP_FIREFOX => 48,
self::PLATFORM_DESKTOP_SAFARI => 9,
self::PLATFORM_DESKTOP_EDGE => 79,
self::PLATFORM_DESKTOP_IE => 12 // e.g. no version
];
private static $mobile = false;
private static $webView;
private static $iPad;
private static $iOS;
private static $android;
private static $handheld;
private static $platform;
private static $apiPlatform;
private static $chromecast;
public static function setMobile($mobile)
{
self::$mobile = $mobile;
}
public static function setIPad($iPad = null)
{
self::$iPad = $iPad;
}
public static function setIOS($iOS = null)
{
self::$iOS = $iOS;
}
public static function setAndroid($android = null)
{
self::$android = $android;
}
public static function setHandheld($handheld = null)
{
self::$handheld = $handheld;
}
public static function setPlatform($platform = null)
{
self::$platform = $platform;
}
public static function setApiPlatform($apiPlatform = null)
{
self::$apiPlatform = $apiPlatform;
}
public static function setChromecast($chromecast = null)
{
self::$chromecast = $chromecast;
}
public static function isMobile()
{
return self::$mobile;
}
/**
* @todo this is not used anymore, remove it from here as well as all usages
*/
public static function isWebView()
{
if (!isset(self::$webView)) {
self::$webView =
strpos(self::getUserAgent(), self::WEB_VIEW_IDENTIFIER) !==
false;
}
return self::$webView;
}
public static function isTabletWebView()
{
return !self::isMobile() && self::isWebView();
}
public static function isIpad()
{
if (!isset(self::$iPad)) {
self::$iPad = strpos(self::getUserAgent(), 'iPad') !== false;
}
return self::$iPad;
}
public static function isIOS()
{
if (!isset(self::$iOS)) {
self::$iOS = preg_match('/iPhone|iPad|iPod/', self::getUserAgent());
}
return self::$iOS;
}
public static function isAndroid()
{
if (!isset(self::$android)) {
self::$android = preg_match('/Android/i', self::getUserAgent());
}
return self::$android;
}
public static function isHandheld()
{
if (!isset(self::$handheld)) {
self::$handheld = preg_match(
'/Android|iPhone|iPad|iPod/',
self::getUserAgent()
);
}
return self::$handheld;
}
public static function isChromecast()
{
if (!isset(self::$chromecast)) {
self::$chromecast = preg_match('/CrKey/', self::getUserAgent());
}
return self::$chromecast;
}
public static function isTablet()
{
return self::isHandheld() && !self::isMobile();
}
/**
* sets correct platform type string for api requests
* @param bool $differentiateMobile
* @return string
*/
public static function getAPIPlatformType($differentiateMobile = false)
{
if (!isset(self::$apiPlatform)) {
$_platform = self::PLATFORM_DESKTOP;
if (self::isMobile()) {
$_platform = self::PLATFORM_MOBILE_WEB;
// TODO: Uncomment that when data migrates to new platform types
//$_platform = self::getSpecificMobilePlatform();
} elseif (self::isTablet()) {
if (self::isAndroid()) {
$_platform =
self::PLATFORM_TABLET_WEB .
'_' .
self::PLATFORM_ANDROID;
} elseif (self::isIOS()) {
$_platform =
self::PLATFORM_TABLET_WEB . '_' . self::PLATFORM_IOS;
}
}
if (self::isChromecast()) {
$_platform = self::PLATFORM_CHROMECAST;
}
self::$apiPlatform = strtolower($_platform);
}
return self::$apiPlatform;
}
public static function getSpecificMobilePlatform()
{
if (self::isAndroid()) {
return self::PLATFORM_MOBILE_WEB . '_' . self::PLATFORM_ANDROID;
} elseif (self::isIOS()) {
return self::PLATFORM_MOBILE_WEB . '_' . self::PLATFORM_IOS;
}
return self::PLATFORM_MOBILE_WEB;
}
public static function getSpecificTabletPlatform()
{
$_platform = self::PLATFORM_DESKTOP;
if (self::isTablet()) {
if (self::isAndroid()) {
$_platform =
self::PLATFORM_TABLET_WEB . '_' . self::PLATFORM_ANDROID;
} elseif (self::isIOS()) {
$_platform =
self::PLATFORM_TABLET_WEB . '_' . self::PLATFORM_IOS;
}
}
self::$apiPlatform = strtolower($_platform);
return self::$apiPlatform;
}
public static function getCurrent()
{
if (!isset(self::$platform)) {
self::$platform = self::getPlatform();
}
return self::$platform;
}
public static function isDesktop()
{
if (strtoupper(self::getCurrent()) == self::PLATFORM_DESKTOP) {
return true;
}
}
/**
* Get User agent string
*
* @return string
*/
public static function getUserAgent()
{
if (isset($_SERVER['HTTP_USER_AGENT'])) {
return $_SERVER['HTTP_USER_AGENT'];
} else {
return '';
}
}
/**
* Get User Hints Browser String
*
* @return string
*/
public static function getUserHintsBrowser()
{
if (isset($_SERVER['HTTP_SEC_CH_UA'])) {
return $_SERVER['HTTP_SEC_CH_UA'];
} else {
return '';
}
}
/**
* check if user agent is chrome
* @return bool
*/
public static function isChromium()
{
$user_agent = self::getUserAgent();
$isChrome = preg_match('/Chrom(e|ium)\/([0-9]+)\./', $user_agent)
? true
: false;
$isMSEdge = preg_match('/Edge\/\d+/', $user_agent) ? true : false;
$isMSEdgeChromium = preg_match('/Edg\/\d+/', $user_agent)
? true
: false;
$isMacOS = self::isMacOS();
return $isChrome && ($isMacOS || (!$isMSEdge && !$isMSEdgeChromium)) ? true : false;
}
/**
* check if user agent is Firefox
* @return bool
*/
public static function isFirefox()
{
$user_agent = self::getUserAgent();
$isFirefox = preg_match('/Firefox/i', $user_agent) ? true : false;
return $isFirefox;
}
/**
* check if user agent is Safari
* @return bool
*/
public static function isSafari()
{
$user_agent = self::getUserAgent();
$isSafari =
preg_match('/Safari/i', $user_agent) &&
!preg_match('/Chrom(e|ium)\/([0-9]+)\./', $user_agent)
? true
: false;
return $isSafari;
}
/**
* check if user agent is OPera
* @return bool
*/
public static function isOpera()
{
$user_agent = self::getUserAgent();
$isOpera = preg_match('/Opera/i', $user_agent) ? true : false;
return $isOpera;
}
/**
* check if user agent is IE
* @return bool
*/
public static function isInternetExplorer()
{
$user_agent = self::getUserAgent();
if (!preg_match('/Mac OS X/i', $user_agent)
&& (preg_match('/MSIE/i', $user_agent)
|| preg_match('/Trident/i', $user_agent)
|| preg_match('/Edg/i', $user_agent))
) {
return true;
} else {
return false;
}
}
/**
* check if user agent is Edge
*
* @return bool
*/
public static function isEdge()
{
$user_agent = self::getUserAgent();
if (preg_match('/Edg/i', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* check if user agent is Edge Chromium specifically
*
* @return bool
*/
public static function isEdgeChromium()
{
$user_agent = self::getUserAgent();
if (preg_match('/Edg\//i', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* check if user agent is IE NOT EDGE
* @return bool
*/
public static function isInternetExplorerNotEdge()
{
$user_agent = self::getUserAgent();
if (preg_match('/MSIE/i', $user_agent) || preg_match('/Trident/i', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* check if user agent is IE or Edge
*
* @return bool
*/
public static function isInternetExplorerOrEdge()
{
$user_agent = self::getUserAgent();
if (
preg_match('/MSIE/i', $user_agent) ||
preg_match('/Trident/i', $user_agent) ||
self::isEdge()
) {
return true;
} else {
return false;
}
}
/**
* check if Internet Explorer version 11
*
* @return bool
*/
public static function isInternetExplorer11()
{
$user_agent = self::getUserAgent();
if (preg_match('/Trident\/7.0; rv:11.0/', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* check if Windows 10
*
* @return bool
*/
public static function isWindows10()
{
$user_agent = self::getUserAgent();
if (preg_match('/Windows NT 10.0/i', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* check if Windows 7
*
* @return bool
*/
public static function isWindows7()
{
$user_agent = self::getUserAgent();
if (preg_match('/Windows NT 6.1/i', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* check if Mac OS X
*
* @return bool
*/
public static function isMacOS()
{
$user_agent = self::getUserAgent();
if (preg_match('/Mac OS X/i', $user_agent)) {
return true;
} else {
return false;
}
}
/**
* Get current platform
*
* @return string
*/
private static function getPlatform()
{
if (self::isMobile()) {
return self::PLATFORM_MOBILE_WEB;
}
/*if (self::isIpad()) {
return self::PLATFORM_IPAD;
}*/
if (self::isTablet()) {
return self::getSpecificTabletPlatform();
}
return self::PLATFORM_DESKTOP;
}
/**
* Get platform data in json format
*
* @return string
*/
public static function getJSON()
{
return json_encode([
'isMobile' => self::isMobile(),
'isWebView' => self::isWebView(),
'current' => self::getCurrent(),
'isHandheld' => self::isHandheld(),
]);
}
/**
* Get browser specific platform type string for desktop. Required by video api calls
* @return string
*/
public static function getVideoApiPlatformType()
{
if (Platform::isChromecast()) {
return self::PLATFORM_CHROMECAST;
}
if (self::isDesktop()) {
if (self::isChromium() || self::isEdgeChromium()) {
return self::PLATFORM_DESKTOP_CHROME;
}
if (self::isFirefox()) {
return self::PLATFORM_DESKTOP_FIREFOX;
}
if (self::isInternetExplorer()) {
return self::PLATFORM_DESKTOP_IE;
}
if (self::isSafari()) {
return self::PLATFORM_DESKTOP_SAFARI;
}
if (self::isOpera()) {
return self::PLATFORM_DESKTOP_OPERA;
}
} else {
return self::getAPIPlatformType();
}
}
/**
* Temporary fix for movies
* @return string
*/
public static function getVideoApiPlatformMovies()
{
if (Platform::isChromecast()) {
return self::PLATFORM_CHROMECAST;
}
if (self::isDesktop()) {
if (self::isChromium() || self::isEdgeChromium()) {
return self::PLATFORM_DESKTOP_CHROME;
}
if (self::isFirefox()) {
return self::PLATFORM_DESKTOP_FIREFOX;
}
if (self::isInternetExplorer()) {
return self::PLATFORM_DESKTOP_IE;
}
if (self::isInternetExplorerOrEdge()) {
return self::PLATFORM_DESKTOP_IE;
}
if (self::isSafari()) {
return self::PLATFORM_DESKTOP_SAFARI;
}
if (self::isOpera()) {
return self::PLATFORM_DESKTOP_OPERA;
}
} else {
return self::getAPIPlatformType();
}
}
/**
* sets HTTP header needed for SSL
*/
public static function setSSLHeaders()
{
if (
isset($_SERVER['HTTP_FRONT_END_HTTPS']) ||
isset($_SERVER['HTTP_X_FORWARDED_SSL'])
) {
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}
}
/**
* Central place to register non-supported browser/OS platforms
* Currently used to limit Irdeto DRM sessions (see VideoModule->setDrmParams())
* @return bool
*/
public static function isSupported()
{
// IE11 (or any IE for that matter) on Windows7 - no longer supported
if (self::isWindows7() && self::isInternetExplorer()) {
return false;
}
return true;
}
/**
* Check if the browser is supported for Desktop
* @return bool
*/
public static function isDesktopSupported()
{
if (!self::isDesktop()) {
return true;
}
$check_functions = explode('|', UNS_DESKTOP_FUNCS);
foreach ($check_functions as $func) {
try {
$data = explode(':', $func);
$method = $data[0];
$check = count($data) > 1 ? boolval($data[1]) : true;
if (self::$method() === $check) {
return false;
}
} catch (\Exception $e) {
}
}
return true;
}
/**
* Check if the browser version is supported
* @return bool
*/
public static function browserVersionAllowed()
{
$version = self::getBrowserVersion();
$platform = self::getVideoApiPlatformMovies();
// special case not supported by getVideoApiPlatformMovies
if (self::isEdge()) {
$platform = self::PLATFORM_DESKTOP_EDGE;
}
if ($version == '?') {
return true;
} else {
if (!
self::MIN_DESKTOP_VERSIONS[$platform]) {
return true;
} else {
if (intval($version) >= self::MIN_DESKTOP_VERSIONS[$platform]) {
return true;
}
}
}
return false;
}
/**
* return the browser version for the most used browsers
* If can't detect the browser return '?'
* @return string
*/
public static function getBrowserVersion()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$ub = "";
// Next get the name of the useragent yes seperately and for good reason
if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) {
$ub = "MSIE";
} elseif (preg_match('/Firefox/i', $u_agent)) {
$ub = "Firefox";
} elseif (preg_match('/OPR/i', $u_agent)) {
$ub = "Opera";
} elseif (preg_match('/Chrome/i', $u_agent) && !preg_match('/Edge/i', $u_agent)) {
$ub = "Chrome";
} elseif (preg_match('/Safari/i', $u_agent) && !preg_match('/Edge/i', $u_agent)) {
$ub = "Safari";
} elseif (preg_match('/Netscape/i', $u_agent)) {
$ub = "Netscape";
} elseif (preg_match('/Edge/i', $u_agent)) {
$ub = "Edge";
} elseif (preg_match('/Trident/i', $u_agent)) {
$ub = "MSIE";
}
$known = array('Version', $ub, 'other');
$pattern = '#(?<browser>' . join('|', $known) .
')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
if (!preg_match_all($pattern, $u_agent, $matches)) {
// we have no matching number just continue
}
$i = count($matches['browser']);
if ($i != 1) {
if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) {
$version = $matches['version'][0];
} else {
$version = $matches['version'][1];
}
} else {
$version = $matches['version'][0];
}
if ($version == null || $version == "") {
$version = "?";
}
return $version;
}
}
* Stack Trace...
- /usr/local/deploy/mvc-deploys/mvc-release/htdocs/index.php(168) calling run()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/app/DooWebApp.php(34) calling routeTo()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/app/DooWebApp.php(127) calling shows()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/core/src/controllers/PlayerURLRedirectController.php(107) calling video()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/core/src/controllers/shows/ShowsVideoController.php(96) calling buildVideoModule()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/core/src/controllers/shows/ShowsVideoController.php(237) calling isDesktopSupported()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/core/src/lib/Platform.php(638) calling browserVersionAllowed()
object(DooConfig)#11 (22) {
["AUTOLOAD"] => NULL
["SITE_PATH"] => string(42) "/usr/local/deploy/mvc-deploys/mvc-release/"
["PROTECTED_FOLDER"] => string(46) "/usr/local/deploy/mvc-deploys/mvc-release/src/"
["BASE_PATH"] => string(70) "/usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/"
["LOG_PATH"] => NULL
["APP_URL"] => string(24) "http://test-www.cbs.com/"
["SUBFOLDER"] => string(1) "/"
["APP_MODE"] => string(3) "dev"
["AUTOROUTE"] => bool(false)
["DEBUG_ENABLED"] => bool(true)
["ERROR_404_DOCUMENT"] => NULL
["ERROR_404_ROUTE"] => string(62) "/error/?%2Fshows%2Fvideo%2FfBpgp9hwzNp7C9d5d0cOZhgr8niNG1cD%2F"
["CACHE_PATH"] => NULL
["AUTO_VIEW_RENDER_PATH"] => string(24) "/shows/video/:content_id"
["MEMCACHE"] => NULL
["TEMPLATE_ENGINE"] => string(7) "DooView"
["TEMPLATE_SHOW_COMMENT"] => NULL
["TEMPLATE_ALLOW_PHP"] => NULL
["TEMPLATE_COMPILE_ALWAYS"] => NULL
["TEMPLATE_GLOBAL_TAGS"] => NULL
["MODULES"] => NULL
["APP_NAMESPACE_ID"] => NULL
}
$_COOKIE Variables
array(0) {
}