Closed (fixed)
Project:
Localizer
Version:
5.x-1.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2007 at 13:11 UTC
Updated:
11 Apr 2007 at 03:30 UTC
Everything was working very fine with my site when suddenly I received the following error afrer accessing my main page:
Fatal error: Only variables can be passed by reference in /home/aladdinw/public_html/sites/test.aladdinweb.net/modules/localizer/localizer.module on line 779
I have discovered that after I delete my php.ini file in that folder the problem disappears. And of course if I deactivate localizer, the problem disappears too.
Isn't is weird???
Comments
Comment #1
ray007 commentedMaybe not necessary in php5, but in php4 I think functions wanting to return references to static objects should be declared doing so, i.e.:
note the ampersand before the functionname.
If I'm right with that, we have a few more offenders.
the offending line from the bug report (line 788 in latest cvs) is
and should probably be changed to something like
good/bad/nonsense?
Comment #2
palazis commentedwell i am using php5 and localizer 5.1-1.7
i can't tell, perhaps you're right...
but sorry what do you mean by good/bad/nonsense???
Comment #3
ray007 commentedThe last line was just meant to gather comments, since I wrote all just in the web-form here and didn't actually test any of it.
Does the 2-line fix work for you?
Comment #4
palazis commentedthanks for the (fast) answer. i tried different things.
theoritically i understand what you say about references...
but practically, no i was not able to find these EXACT pieces of code in line 788.
this is what i did:
LINE 779 of localizer.module file - I commented out the line of code there:
// $nodelocale = key(localizer_get_nodeslocales($force));
and i added after that:
$k = & localizer_get_nodeslocales($force);
$nodelocale = key($k);
Everyting works OK now but I have no idea if there are other changes neccessary (eg in other functions)
???
Comment #5
ray007 commentedMy comment about line 788 was for Roberto, if he wanted to fix it in the (at the time) latest cvs version.
Since you're using php5 you should be fine now, I believe may we have to do some more work regarding references for drupal installations running on php4. I need to read the chapter regarding differences with references between php4 and 5 again ...
Comment #6
Roberto Gerola commentedI have some installations with PHP4 and Localizer, but I have not encountered these errors.
I'll take a deeper look to PHP 4 documentation, in every case.
Comment #7
Roberto Gerola commentedStatic variables are passed in PHP4 by reference and the operator & should be implied.
Can you try this ? :
$k = localizer_get_nodeslocales($force);
$nodelocale = key($k);
Thanks !
Comment #8
ray007 commented> Static variables are passed in PHP4 by reference and the operator & should be implied.
Says who?
Static variables are implemented as references in php4 (see http://de.php.net/manual/en/language.variables.scope.php) ... says nothing about their passing around afaict.
> Can you try this ? :
> $k = localizer_get_nodeslocales($force);
> $nodelocale = key($k);
This should work since you're not trying to modify the array returned by localizer_get_nodeslocales($force);
Comment #9
Roberto Gerola commented>This should work since you're not trying to modify the array returned by localizer_get_nodeslocales($force);
Well. So we have more offending points to fix.
Comment #10
sunlocalizer_get_nodeslocales() no longer exists. So this should be fixed in latest development snapshot.
Comment #11
(not verified) commented