Undefined array key 0 in cascadingdropdown.php

Fabrik Z Release
Joomla! 4.4.2
PHP 8.1.27

in plugins/fabrik_element/cascadingdropdown/cascadingdropdown.php on line 97

94 // $$$ hugh - for reasons utterly beyond me, after failed validation, getValue() is returning an array.
95 if (is_array($opts->def) && !empty($opts->def))
96 {
97 $opts->def = $opts->def[0];
99 }

After a failed validation in another element ( a jdate element ) I get the warning
( ! ) Warning: Undefined array key 0 in /var/www/html/J/plugins/fabrik_element/cascadingdropdown/cascadingdropdown.php on line 97

If i change row 97 in
$opts->def = implode($opts->def);
the warning go away.
 
I don't think so. The dbjoin use the id of anoter list as a foreign key, it cannot be 0.
One detail I can add is that both dbjoin and cascadingdropdown are in a repeating group. Maybe it can make a difference in the handling of array indices.

Thank you
 
On my site I see for line 97
always an array (not only in case of failed validation)
always with key [0] (also for CDD in repeat group)

What do you get with
var_dump($opts->def);
after line 94?

Do you have multiple CDD elements?

I think it won't hurt to add your fix in case of missing array_key 0.
But it would be interesting to know why this is happening.
 
I couldn't resist updating to version 4.0 and now the warning is gone!
Now cascadingdropdown.php is stock, i am sorry but I can't repeat the case again.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top