After migrating applications from SC8 to SC9 I had a few grid applications that included a chart module that threw the following error under PHP 7. When I access the same application using PHP 5.6 there is no error. I am able to do without the chart in this application for now so I’ve removed the chart module and now there is no error under either version of PHP.
The error is:
Fatal error: Can’t use function return value in write context in C:\Program Files\NetMake\v9\wwwroot(Myfolder)(appname)(appname)_resumo_sc_free_group_by.class.php on line 2306.
The error occurs in this function. The bold/underlined text is line 2306:
function getKeysTotals(&$a_keys, &$a_totals, $data, $param)
{
for ($i = 0; $i < sizeof($this->comp_x_axys); $i++)
{
$key_param = key($param);
unset($param[$key_param]);
}
$list_data = $this->comp_chart_axys;
foreach ($param as $now_param)
{
$list_data = $list_data[$now_param][‘children’];
}
$list_data = array_keys($list_data);
$size = sizeof($this->comp_sum_dummy);
foreach ($list_data as $k_group)
{
if (isset($data[$k_group])) {
$totals = $data[$k_group];
}
else {
$totals = $this->comp_sum_dummy;
}
$a_keys[] = $k_group;
$count = 0;
foreach ($totals as $i_total => $v_total)
{
if ($count == $size)
{
break;
}
$a_totals[$i_total][] = $v_total;
$count++;
}
}
if (!empty($param))
{
$a_indexes = $this->getRealIndexes($this->comp_chart_axys, $param);
foreach ($a_keys as $i => $v)
{
if (!in_array($v, $a_indexes))
{
unset($a_keys[$i]);
foreach ($a_totals as $t => $l)
{
unset($a_totals[$t][$i]);
}
}
}
$a_keys = array_values($a_keys);
foreach ($a_totals as $t => $l)
{
$a_totals[$t] = array_values($a_totals[$t]);
}
}
}