I'm debugging a PHP5->7 upgrade and got the following error on this block of code:
PHP7 Fatal error: Switch statements may only contain one default clause
function adserve_cache_get_cache($data = NULL) {
static $cache = NULL;
// if we don't the the cache yet, build it
if (is_null($cache)) {
$cache = module_invoke_all('ad_build_cache');
}
if ($data) {
if (isset($cache[$data])) {
return $cache[$data];
}
else {
return NULL;
}
}
return $cache;
}
The error was generated using the phpmar tool.
I'm wondering if it's a false positive based on this comment code:
/**
* Build and return the cache.
* TODO: It's expensive to build the cache each time we serve an ad, this should
* be cached in the database, not in a static.
*/
Any help would be appreciated.