I have a code field which works fine however I have noticed my log is full of errors when members are renewing or signing up for membership.
Code:
WARNING: Invalid argument supplied for foreach() in .../CB/Plugin/Code/CBCodeField.php(261) : eval()'d code on line 2
Trace:called in class cbpaidErrorHandler::_error_handler_callable(2, "Invalid argument supplied for foreach()", "/home/126397.cloudwaysapps.com/jgzmkbhytt/public_html/components/com_comprofiler/plugin/libraries/CB/Plugin/Code/CBCodeField.php(261) : eval()'d code", 2, array("field" => object(CB\Database\Table\FieldTable), "user" => object(CB\Database\Table\UserTable), "value" => NULL, "names" => "")) on line 2 in file CBCodeField.php(261) : eval()'d code
called in class CB\Plugin\Code\CBCodeField::{closure}(object(CB\Database\Table\FieldTable), object(CB\Database\Table\UserTable), NULL) on line 263 in file CBCodeField.php
called in class CB\Plugin\Code\CBCodeField::outputCode("$names = "";
foreach ( json_decode( '', true ) as $child ) {
$names = $names. " - ".$child['cb_familymembername'];
}
It appears using foreach on an empty json field produces this error. Can anyone help with preventing this?