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);

Comments

chintan4u created an issue. See original summary.

chintan4u’s picture

As 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.

chintan4u’s picture

StatusFileSize
new830 bytes

I added this patch to mee.module 7.x-1.5 files and fatal error stopped but warnings are still coming.

tormi’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
StatusFileSize
new670 bytes

Updated patch against current dev. Fixed paths.

tormi’s picture

Status: Active » Needs review

NR

sceefo’s picture

StatusFileSize
new1.22 KB

In 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.

  • nagy.balint committed 67f371c on 7.x-1.x authored by Sceefo
    Issue #2748141 by chintan4u, tormi, Sceefo: php warnings and error when...
nagy.balint’s picture

Status: Needs review » Fixed

I guess some checks wont hurt, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.