Calc's don't work after latest github update

henk

Member
I updated the laytest github, but all the calc's I have now don't display any value.
Also some seem to get overwritten.
In one list I used many calc's. The list was completely messed up. So I dicided to delete many calc's, then the list became correct.
I tried to add a new calc, same issue. Then create a new list - add a calc, then that works.
So all exsiting calc's seem to be overwritten or something...
I realy can't discover what happened. All was working perfect, untill I updated.
 
The calc element hasn't been changed in many moons -- see Github. So, unless the Fabrik you've been updating was very old, the calc element itself cannot be the reason for your troubles, and an update does not alter the calculations either.
Any other changes or updates that were made? Anything else that the now erratic calculations rely upon? PHP version?
 
Did you clear all Joomla and browser cache?
Are you running any 3rd-party compression (template, plugins...)?
 
Well...
I just replaced \components\com_fabrik\models\list.php with the version from 2021-03-17 and the problem was solved!
 
That doesn't sound good, thanks for reporting.
But I can't replicate.
Which Joomla version, php version are you running?
 
Last edited:
The change to:
if (!empty($data) && isset($data[0]->{$col}))
On line 10778 seems to cause the issue.
 
My guess is that the following applies in this case by replacing array_key_exists by isset (see PHP manual):
"isset() does not return true for array keys that correspond to a null value, while array_key_exists() does."

I use views in my database where some fields have null value. If I replace those by 0 (zero) the issue is also solved.
So I think we need to add some code here to solve for null values. (And that may also be applied for all other isset functions??)
 
That works, thanks Hugh.
Maybe the property_exists() also needs to be used on lines 1062 & 1241 ??

Because of the many warnings in PHP7.4, I set J! error reporting to none.
However if I set error reporting to 'simple', now I get this warning:
Warning: Attempt to assign property 'energ_energie_use_m___E_raw' of non-object in /var/www/html/energie/plugins/fabrik_element/calc/calc.php on line 328
 
Last edited:
OK, already found the cause of that warning:
In my calc I use $row = '{energ_energie_use_m___id}';
I changed $row into $r and the warning was gone.
I guess that using $row is not a good idea; that's like a 'reserved' variabel name in Fabrik.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top