i have joomla site on local server with php5.4 and it works fine but when i upload it to live server it the all site gives error " unexpected [ " on line 491 in example.php when commenting that line it works good but i am not sure if this will make a problem in some extension or not.
line 491 which gives that error
$hash = md5(json_encode([$reftable,$reffield, $refids, $language]));
the complete function code containing this line is:
public function getRawFieldTranslations($reftable,$reffield, $refids, $language)
{
static $cache = array();
$hash = md5(json_encode([$reftable,$reffield, $refids, $language]));
if (!isset($cache[$hash])) {
$db = JFactory::getDbo();
$dbQuery = $db->getQuery(true)
->select($db->quoteName('value'))
->from('#__falang_content fc')
->where('fc.reference_id = ' . $db->quote($refids))
->where('fc.language_id = ' . (int) $language)
->where('fc.published = 1')
->where('fc.reference_field = ' . $db->quote($reffield))
->where('fc.reference_table = ' . $db->quote($reftable));
$db->setQuery($dbQuery);
$result = $db->loadResult();
//$cache[$hash] don't like null value
if (!empty($result)){
$cache[$hash] = $result;
} else {
$cache[$hash] = '';
}
}
return $cache[$hash];
}
so, hot exactly to modify this code to work with php5.3
$pulp = array(); $hash = md5(json_encode($pulp));
is that correct – mohamed May 01 '18 at 22:49