Hey everyone,

I'm kinda new to drupal just installed it today as my personal website and ran into a problem. When I log in as admin go to Administer > Access Control > Configure I get the following error:

Fatal error: Only variables can be passed by reference in c:\Inetpub\wwwroot\modules\user.module on line 1293

I'm not familiar enough with the product yet to give much info so if you need any additional info let me know and will try and get it.

There is a mention of a few patches out but not sure where to find those or how to apply them.

Current system is:

w2k3 sp1
IIS 6
php 5.x latest download as of today. 02/10/05
Drupal latest download as of today. 02/10/05
MySQL latest download as of today. 02/10/05

Everything else seems to be working find, can create content new users can sign up etc.

Any assistance is greatly appreciated.

Comments

barry’s picture

I've been experiencing similar problems with a fresh install i've been playing about with this week. I think the box I'm using is a pretty similar setup.

I've got my techy mate looking into it for me, dunno if he'll figure it out but hey. I'll let you know if he figures it out.

Bloodwine’s picture

Downgrade to PHP 5.0.4 if you can.

I just upgraded my server to 5.0.5 and I got the same error, but I am not running Drupal. I downgraded back to 5.0.4 and all is well.

In my case I am passing the results of a function call to a function that takes a reference.

e.g.:

function Foo (&data) {
// do stuff here
}

function Bar () {
return "hello world";
}

Foo(Bar());

Sounds like PHP 5.0.5 doesn't like that one bit. Probably the fix is to do something like:
$bar = Bar();
Foo($bar);

because it sounds like PHP is forcing the argument to be a variable, and maybe it is treating the results of the function as the string "hello world" instead of a variable.

At anyrate, I consider this to be a PHP bug.

After some googling I found:
http://bugs.php.net/bug.php?id=33643

Apparently Rasmus of PHP doesn't think it is a bug, he thinks the Foo(Bar()) is a bug / badly-written code.

In other words, looks like Drupal will have to update their code to be future-proofed.

EDIT:

you can fix it and keep it as a one liner by doing:
Foo($bar = Bar());

I have done some checking and this is how PHP will require it in PHP 5.0.5+, PHP 5.1, and PHP 4.4.0+

The old way is now broken.

icenogle’s picture

I'm using PHP 5.0.5, and to be explicit about Bloodwine's diagnosis, this change to line 1293 of user.module makes the problem go away:

// Picture settings.
// file_check_directory(file_create_path(variable_get('user_picture_path', 'pictures')), 1, 'user_picture_path');
file_check_directory($foo=file_create_path(variable_get('user_picture_path', 'pictures')), 1, 'user_picture_path');

D Icenogle

icenogle’s picture

Precisely the same bug exists in system.module, accessing administer->themes:

Fatal error: Only variables can be passed by reference in C:\htdocs\modules\system.module on line 649

Of course, it has the same fix.

D Icenogle

henrus’s picture

sorry, i am a newbie. i have the same problem in system.module, same line. do you mean to literally type in "$foo=" in that line? :D

MrMattles’s picture

I had to comment it out before it would work.........I also had to apply the $foo update to line 649.....new apache/php 5.0.5 install

tommyblue’s picture

The bug is in the line 713, but the structure is different and i can't solve it, the line is:

[712] $items[] = array('path' => 'admin/node/configure/types/'. arg(4),
[713]'title' => t("'%name' content type", array('%name' => node_invoke(arg(4), 'node_name'))),
[714] 'type' => MENU_CALLBACK);

I've found it configuring the Event module

barry’s picture

try changing it to:

[712] $items[] = array('path' => 'admin/node/configure/types/'. arg(4),
[713]'title' => t("'%name' content type", array('%name' => node_invoke($foo=arg(4), 'node_name'))),
[714] 'type' => MENU_CALLBACK);
tommyblue’s picture

thank you, but it doesn't work.

i've found the solution adding a line:

$foo = arg(4);
$items[] = array('path' => 'admin/node/configure/types/'. arg(4),
'title' => t("'%name' content type", array('%name' => node_invoke($foo, 'node_name'))),
'type' => MENU_CALLBACK);
kodmasin’s picture

comment deleted

MrMattles’s picture

Could this be applied to only one file or does it need to be applied to all???

pfaocle’s picture

Good Lord

Has this been noted? This is going to cause us major headaches when our server is upgraded next week...

---
paul byrne
paul.leafish.co.uk | www.leafish.co.uk

---
Paul Byrne
pfaocle.co.uk | CTI digital

nick125’s picture

Line 649 and line 25 both have this same issue. Also, has someone tried these changes on PHP 4 to see if it would be compatable?