Octopoos / SEBLOD

Build high-end websites with SEBLOD®, a CCK for Joomla!
https://www.seblod.com
GNU General Public License v2.0
126 stars 54 forks source link

Seblod List field broken in admin view #776

Open Giuse69 opened 9 months ago

Giuse69 commented 9 months ago

Hi, in Seblod 4.1.1, editing a content type in backed that includes a SEBLOD list field breaks with unrecoverable error

`CRITICAL error Uncaught Throwable of type TypeError thrown with message "count(): Argument #1 ($value) must be of type Countable|array, null given". Stack trace: #0 [ROOT]/plugins/cck_field/cck_list/cck_list.php(364): include()

1 [ROOT]/plugins/cck_field/cck_list/cck_list.php(225): plgCCK_FieldCck_List::*render()

2 [ROOT]/libraries/cck/*/cck.php(34): plgCCK_FieldCck_List::onCCK_FieldBeforeRenderForm()`

After some investigation, I see that the problem arises when in libraries/cck/base/list/list.php at line 209 there is $data = $app->triggerEvent( 'onContentSearch', array( '', '', $ordering, $areas['active'], $fields, $fields_order, $config, $current, $options, $user ) ); and when this line is executed in backend/admin form, the result is assigned to $data[4] instead of $data[0], so the following lines to extract config and results fails since they try to be extracted from a null. I don't know the cause of this. An ugly workaround is to switch between $data[0] and $data[4] according to which has values (precisely to which has a not zero size). btw, triggerEvent is deprecated in J4.

Giuse69 commented 7 months ago

still present in Seblod 4.2.0b..