Trying to replace a deprecated line with:
if (new My_Model())->_caching($class)
This broke the PHP7 app with the operator " -> "
PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)
I used above line when trying to replace:
if (self::_caching($class))
which was incorrectly produces a non-static method.
static function search($class,
$table,
$search_options,
$sql_options = array(),
$limit = -1,
$offset = 0)
{
$ci = &get_instance();
$tenant_id = $ci->tenant->id;
if (self::_caching($class))
{
// Check cache first
$cached_objects_key = $class.'-'.md5(serialize($search_options).
serialize($sql_options).$limit.$offset);
if ($cached_keys = $ci->cache->get($cached_objects_key, $class, $tenant_id))
{
$cached_objects = array();
foreach ($cached_keys as $object_cache_key)
{
if ($cached_object = $ci->cache->get($object_cache_key, $class, $tenant_id))
{
array_push($cached_objects, $cached_object);
}
else
{
// we can't complete the list, so break out
// and let the function continue
unset($cached_objects);
break;
}
}
This question was posed for discussing operator -> error and how to remove. Not immediately having to do with referencing arrays.