As noted on #589156: Warnings on PHP 5.3 (and XAMPP) there seams to be an issue when working on PHP 5.3 which triggers the following error:

warning: Parameter 1 to admin_menu_admin_menu() expected to be a reference, value given in includes/module.inc on line 471.

I just tried to analyze the calling function in Drupal 6.14 core and I don't see the need to get the parameter being passed by reference to admin_menu_admin_menu. I just tried to remove the "&" and everything seams to work as expected. (You can reproduce the bug by triggering "Wipe and rebuild" on admin/settings/admin_menu.)

Can you please check and review the attached patch?

Thanks

Comments

BryanGullan’s picture

Hi, came across this while looking into the admin_menu error I was seeing on php 5.3.

Unfortunately, I believe the "&" is needed for PHP 4, and D6 supports PHP 4. Ref a similar discussion regarding the Views module: http://drupal.org/node/452384#comment-2097968

joep.hendrix’s picture

patch works for me (php 5.3)

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
885 bytes

This variable still needs to be altered by reference. We need to fix the caller and not use module_invoke_all. Please test the following patch.

mayobutter’s picture

Yikes. I just spent several hours trying to figure out why the "create content" link was not appearing in the administration menu on fresh installs, and why the Drupal icon menu was not working at all. It looks like this was the culprit. Installed the patch and this did the trick!

moritzz’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Dave. Works flawlessly.

Antinoo’s picture

Please commit this. Thanks. ;-)

marktheshark’s picture

Yes, please commit this to all applicable releases.

Thanks

joetsuihk’s picture

yes, it works on my windows php 5.3 machine, thx

andrewfn’s picture

I've tested it on several sites and it works

davidwatson’s picture

Tested and confirmed on CentOS 5.3 running PHP 5.3. Thanks!

sun’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for reporting, reviewing, and testing! Committed to 6.x-1.x.

A new development snapshot will be available within the next 12 hours. Note, however, that there most probably won't be another official release for 1.x, but you are safe to use the development snapshot.

mathis’s picture

Status: Fixed » Reviewed & tested by the community

Thank you for the patch!

Dave Reid’s picture

Status: Reviewed & tested by the community » Fixed
rmmcclay’s picture

Thanks, Dave, the patch worked for me. Running PHP 5.3.1 =)

Status: Fixed » Closed (fixed)

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

harpreet.sahota’s picture

Thankx it works perfect.

We just need to remove '&' from "admin_menu_admin_menu(&$deleted)" and make it like "admin_menu_admin_menu($deleted)" in "admin_menu.inc" file.

Maguar’s picture

harpreet.sahota, Thanks a lot!!!

pouvoir’s picture

usefull!
many modules have same issue。

rushala’s picture

Thanx so much, @Harpreet

AdrianB’s picture

@sun #11: Just curious, why won't there be any more official releases for 1.x?

I understand that the -dev version is stable, but I have clients who prefer to run only official releases. And since shared hosting companies are starting to switch to PHP 5.3 this problem will affect many users of this fantastic module.

Guru’s picture

It works. Thanks!

aquila’s picture

@AdrianB @sun I am experiencing the same problems, clients prefer stable versions.
This would be a good candidate for a very small but important update to the stable version?

alternata99’s picture

Hello!

I am a non-coder Drupal beginner.
I've installed locally Drupal on a Windows machine and I'm building a site.

I get all the time the following alert:
Parameter 1 to admin_menu_admin_menu() expected to be a reference, value given en F:\xampp\htdocs\drupal\includes\module.inc on line 483.

I understand that the above mentioned patch offers a solution for a PHP 5.3 flaw. Did I understand well?

I have no idea how to install the patch.

Should I find a tutorial and install the patch or I can live with it (with no consequences for the site I'm building) until a PHP upgrade eventually solve it?

Thanks in advance for your responses.

ami7878’s picture

This patch worked for me on php5.3.2

jhedstrom’s picture

I'm also curious why this fix won't be ported to an official release. Given that php 5.3 is standard on the newly released ubuntu 10.04 lts, it seems that more and more people will start to come across this, and once hosting platforms upgrade, even more sites will be affected.

cha0s’s picture

@jhedstrom: You go to sites/all/modules/admin_menu (or where you installed it) and invoke this command from a terminal:

wget -O - http://drupal.org/files/issues/615058-adminmenu-php53-D6-1.patch | patch -p0

AdrianB’s picture

It's been two months since I asked so I humbly repeat my question:

@sun #11: Just curious, why won't there be any more official releases for 1.x?

alternata99’s picture

Hi, ami7878

Would you please explain how did you patched PHP?

I'm a beginner and I'll appreciate very much your detailed explanation.

Thanks in advance.

alternata99’s picture

--x--

mrtoner’s picture

@AdrianB (#28): Your question probably hasn't been answered because 1) it's off-topic (open a new issue) and 2) it was asked in a closed issue (developers don't usually pay attention to closed issues -- open a new issue).

AdrianB’s picture

@mrtoner #31: 1) Yes, it was off topic, but it was sun who brought it up in this issue, so I thought it was ok to ask. But I think you're right about 2). And I thought about making this active but I didn't feel that was the right thing to do. I'll think about open a new issue (probably the next time I have to explain to a client why I chosen the dev version instead of the stable one... :)).

burt.lo’s picture

FYI: I used this patch to solve the error on my Drupal 6 + PHP 5.3 install, but didn't have the wget command installed. Here's a page that showed clear instructions for doing so:

http://www.bergek.com/2008/03/08/install-wget-on-mac-os-x/

j0rd’s picture

Issue tags: +PHP 5.3

I'd recommend at least applying this patch to a 1.x-dev branch, so that Ubuntu 10.04 users will have something to upgrade too instead of having to find this patch.

mcrittenden’s picture

Status: Closed (fixed) » Patch (to be ported)

Changing status based on #34.

moritzz’s picture

@mcrittenden Was this patch applied to the dev-Release? If not, I don't see the need to close it.

mcrittenden’s picture

@moritzz: I didn't close it. I changed it to patch to be ported so that the fix could be applied to 6.x-1.x.

moritzz’s picture

@mcrittenden Sorry, I missed the point. No offense and thanks. :)

angheloko’s picture

Patched worked for me - Ubuntu 10.04, D6.16, PHP5.3.

Thanks!

Just curious, was the warning message harmful? I initially thought of it as simply annoying.

aaron’s picture

@angheloko afaik, it's just a warning, that had no effect one way or other. because of deprecated php behavior.

kirtan’s picture

it's working for me,thanks.

cha0s’s picture

Just to note, the warning can actually break functionality, AFAIK

ayalsule’s picture

Status: Patch (to be ported) » Closed (fixed)

worked for me

mcrittenden’s picture

Status: Closed (fixed) » Patch (to be ported)

This won't be fixed until the patch is committed to 1.x.

jokerejoker’s picture

FileSize
519 bytes

I have made this patch. This is the correct way that keeps the variable reference, so this will work with both php 4 and 5.3 :)

sun’s picture

Status: Patch (to be ported) » Fixed

The original patch was committed to 1.x-dev already.

stephenplatz’s picture

The patch worked for me, be sure to wipe and rebuild the admin_menu afterwards. I'm using PHP Version 5.3.2-1ubuntu4.2.

renamixtech’s picture

harpreet.sahota, thank you very much! It's working great now!

Status: Fixed » Closed (fixed)

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

tinem’s picture

I have made your suggested changes but still get this error and don't know why? But is it important? The site is functioning on my local computer as I wanted it to also after I needed to download the dev vers. 6.x-2.x-dev from date module.

powery’s picture

Version: 6.x-1.5 » 6.x-3.x-dev
Priority: Critical » Normal
Status: Closed (fixed) » Needs work
sun’s picture

Version: 6.x-3.x-dev » 6.x-1.5
Status: Needs work » Closed (fixed)

This hook does not exist in 3.x.

Harry Slaughter’s picture

Status: Closed (fixed) » Active

this bug still exists, and i didn't want to open a new ticket :)

warning: Parameter 1 to admin_menu_admin_menu() expected to be a reference, value given in /var/www/drupal_6_dev/includes/module.inc on line 483.

it does not occur consistently. i haven't noticed how to make it occur, but on a new install, it should appear in short order.

Harry Slaughter’s picture

Status: Active » Closed (fixed)

ah, just realized the fix is presumably in the dev version

klausi’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
Status: Closed (fixed) » Active

this fix is really old ... PHP 5.3 is common now, so can we please create a new 1.x release?

lucascaro’s picture

Version: 6.x-1.x-dev » 4.7.x-1.0

I've just installed 6.x-3.0-alpha4 and the bug appears to be fixed.

sun’s picture

Version: 4.7.x-1.0 » 6.x-1.5
Status: Active » Fixed
klausi’s picture

Status: Fixed » Active

not fixed in 1.5, is it?

sun’s picture

Status: Active » Fixed

It was a bug in 6.x-1.5. And it is fixed in 6.x-1.x-dev.

I've not used 1.x for round about 1.5 years, so I'd have to test it manually before being able to create a new release.

klausi’s picture

Version: 6.x-1.5 » 6.x-1.x-dev

Ok, that indicates that the 3.0-alpha4 release is actually the more stable and supported one (especially for PHP 5.3). Could you make the 3.0-alpha4 release then the recommended one?

sun’s picture

Version: 6.x-1.x-dev » 6.x-1.5

You likely want to read the big notice on the project page: http://drupal.org/project/admin_menu

PS: This bug last existed in 6.x-1.5. It does not exist in 6.x-1.x-dev. The proper version is therefore 6.x-1.5.

AdrianB’s picture

I understand that 3.x needs help and focus, but I don't understand why the 1.x branch couldn't get another stable release. Sometimes in Drupal it feels like where forever stuck in the -dev version hell with all the negative side effects of that.

I repeat what I said above: I understand that the -dev version is stable, but I have clients who prefer to run only official releases. And since shared hosting companies are starting to switch to PHP 5.3 this problem will affect many users of this fantastic module.

klausi’s picture

You likely want to read the big notice on the project page: http://drupal.org/project/admin_menu

Yep, saw that. I appreciate your hard work but those bugs don't seem to go away anytime soon. The problem is that admin_menu now has 2 unsupported releases, so I suggest that you make the less annoying one (3.x) the recommended one. Especially if you don't want to touch 1.x anymore.

Anyway, I go with 3.0 now and will shut up.

Status: Fixed » Closed (fixed)

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

srahul07’s picture

Thanks Dave. The patch worked for me. In my case the admin_menu was not showing the drupalicon menu with flush cache, etc. Now it is working.

Kudos to you man....

maggie_au’s picture

Thanks comment #3~~~ It helps~~~

azzerpa’s picture

what do you mean terminal? I'm lost on how to invoke the command. I'm a new Drupal user and I'm lost... I'm using cpanel.

j0rd’s picture

@azzerpa by `terminal` they mean "DOS" type command line. If you're using cPanel, you might have access to your box via an SSH client. If you're using Windows, you can use Putty.

For more information it's probably best you search your server hosts documentation, or send them an email or telephone call.