Download & Extend

Invalid argument supplied for foreach() /includes/menu.inc on line 258

Project:Content Construction Kit (CCK)
Version:6.x-2.x-dev
Component:General
Category:task
Priority:critical
Assigned:manjit.srijan
Status:closed (fixed)

Issue Summary

Two days ago I performed an update from 6.x-2.0-beta to 6.x-2.x-dev. Since then I get the error message
warning: Invalid argument supplied for foreach() in /usr/home/caiiorg/public_html/includes/menu.inc on line 258.
as soon as I edit one of my pages.
It doesn't seem to have any negative effect though, but still my users editing the page are uncomfortable...

Would be great if there'd be a fix for this!

Comments

#1

I'm getting the same message

Google shows a fix in contemplate ..
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/contemplate...

And also a fix in userpoints...
http://drupal.org/node/239476

In both cases the fix involved some changes to the menu declarations.

#2

In case it might help, the message is probably related to the fact that in Drupal 6 "access arguments" changed to an array. I ran across this issue in an attempt to fix the same error message in a module I'm updating, so I'm just passing along what I found that helped me.

#3

Status:active» fixed

What makes anyone think this is a CCK issue? I see no reason to think it has anything to do with CCK. Every place in CCK that uses access arguments is already using an array.

If there is some reason to think this is coming from CCK, I need more info.

--project followup subject--

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

#4

Status:fixed» closed (fixed)

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

#5

I'm getting the same error at http://bowtasticboutique.com, I upgraded a couple modules at once last week and I can't seem to pinpoint which is causing the issue? Anyone know a new module that is now causing this same problem

#6

From what a couple of others have said online this error may be appearing as the menu does not like an argument passed to it.

http://www.centurionwebdev.com/content/warning-invalid-argument-supplied...
http://www.aprium.net/content/error-menuinc-line-258

In my case I think its from a new 'view' that I am using an argument in (but I have no idea how or whether this needs 'fixing').

#7

Ok I am following this up as I think I may have solved the errors I am having - fingers crossed.

I have 'Pathauto' module loaded and mistakedly used a leading slash in the replacement paths.

So for example my default is [menupath-raw] but I had put /[menupath-raw]

Hope that helps someone.

#8

Bother that was a premature evaluation!

Am still getting these errors.

Best I can do is post the code here in the hopes that one of the core development team see it, and know how to explain what all our problems may be.

/**
* The menu system uses serialized arrays stored in the database for
* arguments. However, often these need to change according to the
* current path. This function unserializes such an array and does the
* necessary change.
*
* Integer values are mapped according to the $map parameter. For
* example, if unserialize($data) is array('view', 1) and $map is
* array('node', '12345') then 'view' will not be changed because
* it is not an integer, but 1 will as it is an integer. As $map[1]
* is '12345', 1 will be replaced with '12345'. So the result will
* be array('node_load', '12345').
*
* @param @data
* A serialized array.
* @param @map
* An array of potential replacements.
* @return
* The $data array unserialized and mapped.
*/
function menu_unserialize($data, $map) {
if ($data = unserialize($data)) {
foreach ($data as $k => $v) {
if (is_int($v)) {
$data[$k] = isset($map[$v]) ? $map[$v] : '';
}
}
return $data;
}
else {
return array();
}
}

#9

Solution...
looks like hook_menu --> 'access arguments' is expecting an array...

replace this
'access arguments' => 'edit your mom',

with this:
'access arguments' => array('edit your mom')

#10

Category:support request» task
Priority:normal» critical
Assigned to:Anonymous» manjit.srijan

Solution...
looks like hook_menu --> 'access arguments' is expecting an array...

replace this
'access arguments' => 'edit your mom',

with this:
'access arguments' => array('edit your mom')
Posted by ianfoxfire on September 25, 2009 at 4:26pm

What is edit your mom.

nobody click here