Trying to add a new custom page with context_admin, I get stuck after choosing anything in the contextual administration type. Any choice would show this error:

Fatal error: Unsupported operand types in C:\Web Development\xampp\htdocs\alarabiya\sites\all\modules\context_admin\plugins\task_handlers\menu_context.inc on line 349

Using Chaos Tools 6.x 1.8

CommentFileSizeAuthor
#12 php_5.3_fixes-1072389-12.patch1.4 KBDeciphered
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

EclipseGc’s picture

What version of php are you using? (just for my graticification).

Eclipse

Mamoun’s picture

PHP 5.3.1 (PEAR)
Xampp 1.7.3

EclipseGc’s picture

Can you test on 5.2.4+? 5.3 is still unsupported by much of Drupal 6 contrib, including context_admin. With the advent of the new git vcs I do hope to get the time to start fixing these sorts of issues, but I suspect this is a php version issue.

Mamoun’s picture

Downgraded to 5.2.11 now, no more errors! Thank you very much for your help and for the great module. :)

I'm glad you pointed out the fact that some modules are incompatible with php 5.3, this might explains several unexplained errors I stumbled upon using some modules, so thank you again!

EclipseGc’s picture

Status: Active » Closed (fixed)

Happy I could help. 5.3 is definitely a priority for me going forward, but only really for the 7.x branch (that I'll hopefully commit today some time) so... I'm glad you like the module I have great future plans I hope to implement :-D

caschbre’s picture

What part of that line is unsupported? I've come across the same issue and I'd love to help patch context_admin 6.x instead of having to roll back to a previous version of php.

christefano’s picture

Status: Closed (fixed) » Active

caschbre: I just started looking into this but at first glance it's because module_invoke() can't be used to pass by reference.

Changing status to "active". PHP 5.3 has been out since June, 2009.

EclipseGc’s picture

Assigned: Unassigned » EclipseGc
Status: Active » Patch (to be ported)

So, 7.x has fixes for this, they just need to be backported. Essentially 6.x is utilizing the plugin system incorrectly, and when we use it properly, these issues go away.

Again I'll see if I can allot some time, maybe this weekend, to backport the 7.x fixes for this stuff.

Eclipse

jonskulski’s picture

Eclipse,

Can you post to the patches you mentioned in case someone has time to port them.

jonskulski’s picture

Just some notes from investigating. Seems to be related to:

#647064: Fatal error: Unsupported operand types when menu_links query returns no results in system_admin_menu_block()

and a lot of modules are dealing with it:
#785930: Fatal error: Unsupported operand types
#595724: After core upgrade: Fatal error: Unsupported operand types ... /modules/system/system.module on line 627
....etc

For the record, I was trying to implement a page as a default local task. I switched the page to normal task and it went away. Which makes sense since that line

$item += db_fetch_array(db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = '%s' AND module = 'system'", $item['path']));

is essentially asking for a normal menu item.

EclipseGc’s picture

@jonskulski

Thanks for running that down. I'll look into it more (work's had me totally slammed lately) but I think the answer is "replace this functionality with something custom" which is actually a topic that has come up in conversation a few times. I tried to just reuse core whenever possible and that has proven to be mostly impossible, so... I guess this instance shouldn't be a surprise.

Deciphered’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.4 KB

Patch attached to fix the issue, checks to see if the value returned from the module_invoke is an array() before trying to += it. Alternative approach would be to enforce that an array is always returned.