First I know the problem here and can fix it, but I don't know how to create a patch file, nor do they give me access to my /sites/all/modules at my work.

This error shows up anywhere menu_target_edit_form_extra_elements() is used unless you have php 5.5 or later. If your organization is stuck earlier than that and it is beyond your control, then the empty() function can only accept variables, not return values from other functions.

so line 19 of menu_target.admin.inc
if (empty($enabled_menus) || empty(array_filter($enabled_menus))) {
will cause the error mentioned in the title.

this can be fixed by just doing the same thing in a different way. The following change should work.
if (empty($enabled_menus) || !count(array_filter($enabled_menus))) {

Could this small fix make it into a release please so that a normal update will resolve the problem on older versions of php.

Comments

gyan1010 created an issue. See original summary.

antoniog4’s picture

StatusFileSize
new522 bytes

gyan1010 - I've done a quick patch based on your suggestion above, see if it works for you.

For understanding how to create a patch, see: https://www.drupal.org/node/707484

pasqualle’s picture

Category: Support request » Bug report
Priority: Major » Critical
Status: Active » Reviewed & tested by the community

the fix works

egarbeil’s picture

The fix works, but I had problems with the patch file. Had to apply manually, which isn't a big deal.

oostie’s picture

I'm sorry, but i really can't and will not support PHP 5.4 or older versions. These versions are End of life for years now. I will close the issue now but the patch will be available for download.

oostie’s picture

Status: Reviewed & tested by the community » Closed (won't fix)
crutch’s picture

Just encountered this. Lots of hosts still running PHP 5.4