From 04b99f53fccdca41a135b139da1c9aeef7a26e89 Mon Sep 17 00:00:00 2001 From: Svetlin Nakov Date: Thu, 14 Nov 2019 10:50:34 +0200 Subject: [PATCH] Fixed incompatibility with PHP 7.2+ See detailed bug description here: https://wordpress.org/support/topic/hyper-cache-extended-not-compatible-with-php-7-2 --- cache.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cache.php b/cache.php index aaf25a8..54c2522 100755 --- a/cache.php +++ b/cache.php @@ -384,12 +384,15 @@ function hyper_mobile_type() { return ''; $hyper_agent = strtolower($_SERVER['HTTP_USER_AGENT']); - foreach ($hyper_cache['mobile_agents'] as $hyper_a) { - if (strpos($hyper_agent, $hyper_a) !== false) { - if (strpos($hyper_agent, 'iphone') || strpos($hyper_agent, 'ipod')) { - return 'iphone'; - } else { - return 'pda'; + $mobile_agents = $hyper_cache['mobile_agents']; + if (is_array($mobile_agents) || is_object($mobile_agents)) { + foreach ($mobile_agents as $hyper_a) { + if (strpos($hyper_agent, $hyper_a) !== false) { + if (strpos($hyper_agent, 'iphone') || strpos($hyper_agent, 'ipod')) { + return 'iphone'; + } else { + return 'pda'; + } } } }