Page not found: .../includes/menu.inc on line 1224

Dahaniel - May 19, 2007 - 13:12
Project:Drupal
Version:5.5
Component:menu system
Category:support request
Priority:critical
Assigned:Unassigned
Status:by design
Description

Every now and then I get this Errors:

* warning: array_keys() [function.array-keys]: The first argument should be an array in .../includes/menu.inc on line 1224.
* warning: Wrong parameter count for min() in .../includes/menu.inc on line 1224.

The the menu disappears and I get "Page not found errors". The only page I can access is the userprofile page.

#1

Dahaniel - May 19, 2007 - 13:38

I just found out that it seems to be an issue with the menu cache.

I kan get the menu back to work when I flush the "menu_cache" table. The error seems to appear again when I do edit something related to the menu (i.e. adding language pack rows affecting menu points).

#2

deavidsedice - May 25, 2007 - 21:30

¿Have u run update.php?
This problem can be related in a module update without the proper update of the DB.

#3

Dahaniel - May 26, 2007 - 10:14

I never updated any module, all first installs. But yes, I ran the update.php several times.

It seem like once every menu item was accessed once (with a thousand times flushing the menu_cache) everything works pretty stable. But one false step and I got the error back :(

#4

deavidsedice - May 27, 2007 - 00:35

I can write a small patch to evade these errors, but that will not correct your problem.

It is possible, that one of your installed modules is causing the problem.
Try to disable all modules, and test again. Try to find the module that is giving this error.

If you find it, try to upload it again. A newer version would be nice. Some times, FTP uploads get broken if you have a bad connection to inet.

#5

Dahaniel - May 28, 2007 - 15:19

I already installed the modules one by one, saving the database after each module. Then I found one where the error suddenly appeared, went back with the database and skipped this module. (I think it was comment_mail) But now, without the module, the error is here again.

#6

Dahaniel - May 30, 2007 - 20:48

Found this page which describes a similar error.

http://www.ms75.de/site/node/89

For those who are not too good in german, the author says that in php 5.1 the handling of arrays has changed so old modules get problems. You could fix this by adding this line:
$arguments = array(); to menu.inc so it looks like this afterwards:

if (strlen($arg)) {      
    $arguments = array();
    $arguments = array_merge($arguments, explode('/', $arg));
  }

I did this but right now I got the eror again, but now in line 1225 instead of 1224 :)

Could this be the right way? To be honest I do not have a clue about arrays just that it is a type of a variable...

I'm using php 5.2

#7

deavidsedice - May 31, 2007 - 08:03

Ok, then try this: (I think that patch you posted isn't working)

On line 1223-1224, you should have:
// Menu items not in the DB get temporary negative IDs.
$temp_mid = min(array_keys($_menu['items'])) - 1;

Patch with:
// Menu items not in the DB get temporary negative IDs.
$temp_mid = is_array($_menu['items']) ? (min(array_keys($_menu['items'])) - 1) : -1;

And try.
Good luck!

#8

Dahaniel - May 31, 2007 - 09:27

Thank you, I will try this!

#9

Dahaniel - May 31, 2007 - 10:41

Had the "Page not found" error and the disappeared menu again. But this time without the error message.
So the Problem themes to be there only the message is suppressed...

#10

Dahaniel - May 31, 2007 - 10:55

Additionally it seems like only the admins get the error so I assume it is somehow connected to the admin-menu.

#11

deavidsedice - May 31, 2007 - 10:57

I said: "I can write a small patch to evade these errors, but that will not correct your problem."

And here it is, the problem is yet there, but the error habe been dissapered.

Ok, there are some PHP code that is broken. Take a look into your modules, your themes... it must be there.
I repeat, this error is NOT onto your DB. Is a PHP code error.

For example, a module that have a hook_menu written in it, but the function does not return an array.

You can also try to create other database for Drupal, and configure /sites/default for use it. Try to enable in this site, the modules one by one. If you find what module is, you can delete this DB, and reconfigure /sites/default/ to use the original DB.

And you can make a list of modules installed, and post it here.

#12

Dahaniel - May 31, 2007 - 11:23

Ok, sorry, I thought the solution with the suppressed error message had nothing to do with this one.
As I said, I already activated module by module and in this actual installation I am not using comment_mail on whose activation the error appeared. But it must have been an module before so maybe I can recall from my database backups which module I activated right before.

I already posted an module list some days agon an my blog if you want to have a look:

http://daniel.hirngespinst.net/2007/05/15/drupal-macht-mich-fertig/#comm...

here the one in front of comment_mail is birthdays, which is buggy anyway. I deactivated it some minutes ago. The error was still there.

#13

crapufish - September 6, 2007 - 20:17

Anyone found the cause of this error?
Thanks!

#14

Dahaniel - September 13, 2007 - 08:15

No, sorry.

We were moved to another server by our hoster. Now everything works fine!

#15

jefftrnr - October 31, 2007 - 16:47

I'm having the same trouble when trying to delete a font in the sIFR module.

What about fixing (hacking?) it this way?

if (strlen($arg)) {
if ($arguments && !is_array($arguments)) $arguments = array($arguments);
$arguments = array_merge($arguments, explode('/', $arg));
}

I'm not happy changing any files in the Drupal core, though. But, what is my alternative?

#16

Nathalievp - November 22, 2007 - 07:51

I have the same trouble.

I have installed a new drupal site, with a new database.

The modules that are enabled are all core drupal modules, no other modules.

#17

xDiL - December 21, 2007 - 22:22
Version:5.1» 5.5

I have resolved this issue with update.php :)

#18

yched - December 23, 2007 - 03:01
Status:active» by design

#19

progga - May 20, 2008 - 23:15

I was having the same problem after the ISP moved the Drupal database from MySQL 5 to MySQL 4.1 !!!
I cleared all the cache tables (cache, cache_content, cache_filter, cache_menu, cache_page) and requested index.php from the browser a few times and the errors were gone! I don't claim any understanding of this solution, but HTH :-)

 
 

Drupal is a registered trademark of Dries Buytaert.