Problem statement :
Getting PHP warnings and error when MEE setting is enabled for field collection field, because of PHP fatal error we are unable to save content.
From error log :
Warning: Illegal string offset 'resource_manager' in _mee_process_item_value() (line 710 of /sites/all/modules/contrib/scald/modules/fields/mee/mee.module).
Warning: Illegal string offset 'resource_manager' in _mee_load_resources() (line 740 of /sites/all/modules/contrib/scald/modules/fields/mee/mee.module).
Warning: Illegal string offset 'resource_manager' in _mee_load_resources() (line 741 of /sites/all/modules/contrib/scald/modules/fields/mee/mee.module).
Warning: Illegal string offset 'resource_manager' in _mee_load_reources() (line 742 of /sites/all/modules/contrib/scald/modules/fields/mee/mee.module).
Error: Cannot use string offset as an array in _mee_load_resources() (line 742 of /sites/all/modules/contrib/scald/modules/fields/mee/mee.module).
Code on these lines :
Line 710 if (empty($item['mee']) || !is_array($item['mee']['resource_manager'])) {
Line 740 to 742
$item['mee']['resource_manager'] = array();
$item['mee']['resource_manager'] = $result->fetchAllAssoc('atom_sid', PDO::FETCH_ASSOC);
$item['mee']['resource_manager'][0] = array('weight' => 0, 'required' => FALSE);
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 2748141-6.patch | 1.22 KB | sceefo |
| #4 | 2748141-4.patch | 670 bytes | tormi |
Comments
Comment #2
chintan4u commentedAs a workaround, I just added isset to line 742 to avoid error and node are getting saved. but surely this is not the final solution.
if(isset($item['mee']['resource_manager'])){
$item['mee']['resource_manager'][0] = array('weight' => 0, 'required' => FALSE);
}
Pls let me know if anyone has better solution.
Comment #3
chintan4u commentedI added this patch to mee.module 7.x-1.5 files and fatal error stopped but warnings are still coming.
Comment #4
tormiUpdated patch against current dev. Fixed paths.
Comment #5
tormiNR
Comment #6
sceefo commentedIn php7 there was one array that needs to be checked to make this work for our project. Issues were with wysiwyg and dnd images when using mee.
Comment #8
nagy.balint commentedI guess some checks wont hurt, thanks!