I have installed the following softwares in my windows xp.
1) xampp-win32-1.7.2.exe
2) drupal-6.14.tar.gz
3) user_relationships-6.x-1.0-rc2.tar.gz
The site is working fine before enabled the following user relationships modules.
UR-API
UR-Blocks
UR-Defaults
UR-Elaborations
UR-Implications
UR-Mailer
UR-Node Access
UR-UI
Some warning alerts display after enabled user relationship modules:
warning: Parameter 2 to user_relationship_defaults_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_elaborations_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_mailer_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_defaults_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_elaborations_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_mailer_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_defaults_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_elaborations_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_mailer_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_defaults_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_elaborations_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
warning: Parameter 2 to user_relationship_mailer_user_relationships() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 471.
Comment | File | Size | Author |
---|---|---|---|
#27 | php53fixes.patch | 3.1 KB | Berdir |
#1 | module.inc_471_line.JPG | 115.61 KB | rickydrupal |
#1 | module.inc_.txt | 16.04 KB | rickydrupal |
warning.JPG | 135.33 KB | rickydrupal |
Comments
Comment #1
rickydrupal CreditAttribution: rickydrupal commentedDue to the upload file type limit, i amended "module.inc" to "module.inc.txt"
Please kindly help. thank you very much
Comment #2
rickydrupal CreditAttribution: rickydrupal commentedi can't use this user_relationships module. why no one reply me?
can't display the link to add friend
Comment #3
jicke11s CreditAttribution: jicke11s commentedI have a similar error message but mine is related to enabling the Administration Module.
When I enabled this module the following warning appeared:
Parameter 1 to admin_menu_admin_menu() expected to be a reference, value given in C:\xampp\htdocs\&nameofmysite\includes\module.inc on line 471
I have recently installed Drupal 6.14 on localhost. The XAMPP package used for downloading used php version 5.3.0 and I'm running in Window XP
Interestingly, the admin menu has appeared as expected but with the above error message.
Hoping someone can help.
Thanks
SueJ
Comment #4
izmeez CreditAttribution: izmeez commentedThis is related to PHP 5.3
If you use an earlier version of XAMPP that does not use PHP 5.3 the problem will go away.
I am not sure of the status of a fix in Admin menu.
Izzy
Comment #5
jicke11s CreditAttribution: jicke11s commentedDear Izzy:
Thanks for this. I wondered if this was the case. I'll get hold of an earlier version of php and see if this solves the problem in the Admin menu.
SueJ
Comment #6
fpdiver CreditAttribution: fpdiver commentedJust upgraded to PHP5.3 and experiencing the same problem. Not really an option for me to rollback unfortunately. Will keep an eye out for a fix.
Comment #7
NelM CreditAttribution: NelM commentedIt's the pass by reference that is causing a problem, i racked my brains out for week with this one, what I did was to open the admin_menu.inc and find any "&$" and change it to "$", that's what giving you the conflict, almost all the modules are affected by this, there are a lot of patches going around for each individual module, try downloading and applying the patch and your problems will go away. or better install xampp with 5.2 :), or just do the above mentioned solution.
im using xampp on win xp machine. running php 5.3
Comment #8
izmeez CreditAttribution: izmeez commentedNeIM, thanks for such a clear answer.
Izzy
Comment #9
alex.k CreditAttribution: alex.k commented@izmeez @NelM thanks a lot for posting the solution. Shall we mark it "by design"?
Comment #10
izmeez CreditAttribution: izmeez commented@alex.k with respect, are you kidding?
I thought @NeIM identified the culprit code and it would be considered for the next revision.
I don't understand how this would be "by design" and remain compatible with PHP upgrades.
I will have to leave the status to be determined by the module maintainers.
Izzy
Comment #11
alex.k CreditAttribution: alex.k commented@izmeez I'm not familiar with XAMPP specifically, but passing by reference is perfectly valid PHP. Even more, the code in a lot of places relies on the fact that it's a reference and the changes made will not be lost when the function terminates.
The suggestion to patch drupal core and all modules just can't be right. Which leads me to believe it's specific to certain versions of XAMPP.
Comment #12
izmeez CreditAttribution: izmeez commentedThanks, you may be right. This may have no bearing on User Relationships although it may be a factor for the Admin menu module. There have been similar php 3 related issues in some other module queues such as the date module. Thus I did not think it was XAMPP specific but rather a php 3 issue for modules to consider.
My apologies for my lack of understanding of the User Relationships module.
Izzy
Comment #13
Mark Theunissen CreditAttribution: Mark Theunissen commentedalex.k, yes of course pass-by-reference is valid, but in PHP 5.3 if a function defines one of it's parameters as a reference and you give it a value instead, this causes warnings. The same code is technically wrong in 5.2 too, but in 5.3 it's just much stricter. You can't do this:
Passing a string to a function that wants a variable reference is a mistake.
Comment #14
alex.k CreditAttribution: alex.k commentedMark, thanks for the explanation. It does work without warnings on PHP 5.3 on Mac OS, so I guess, XAMPP's settings are stricter by default. Could someone provide a patch that takes care of the warnings on XAMPP?
Comment #15
Mark Theunissen CreditAttribution: Mark Theunissen commentedYes, it is plausible that the defaults are more lenient.
Open up your php.ini, and under the section "Error reporting", you should set it to error_reporting = E_ALL | E_STRICT and display_errors = On.
In php.ini, on PHP 5.3, you will see each section has a recommended "Development environment" setting, just use those and you should see the error.
It doesn't happen *all the time* though, just I think when rebuilding the menu cache.
Comment #16
moritzz CreditAttribution: moritzz commentedHi Folks. Please check out #615058: Parameter 1 to admin_menu_admin_menu() expected to be a reference. Thanks.
Comment #17
raymondberg CreditAttribution: raymondberg commentedWhere are we at with this? Mark explained (#13) that this is clearly going to be a problem going forward with PHP releases.
Has anyone else checked out omo's proposed patch (#16)? I'd like to get at least one success story from someone before I start digging into the source. It just seems like changing the method definition raises a lot of red flags.
Comment #18
raymondberg CreditAttribution: raymondberg commentedI changed the status of this topic to NR because this issue has effected installations on both WAMPServer and XAMPP with no viable solutions or workarounds.
In my tests, changing the error logging (to exclude warning-level entries) does not resolve this issue. Unless there's documentation on why and how-to-resolve I don't see how this can be "by design".
Comment #19
alex.k CreditAttribution: alex.k commentedYes it seems that UR has some code that is not 5.3-friendly. Could one of XAMPP users provide a patch that has corrected the errors? I can't reproduce the issue and don't have XAMPP handy to try.
Comment #20
izmeez CreditAttribution: izmeez commentedSorry, I am not aware of a patch for XAMPP, I reverted to an earlier version of XAMPP.
Izzy
Comment #21
alex.k CreditAttribution: alex.k commentedChanging the title to reflect the issue. Looking for a patch to correct this.
Comment #22
tsbah CreditAttribution: tsbah commentedAdequate thus excellent patch!!!
Thanks
Comment #23
rickydrupal CreditAttribution: rickydrupal commentedThanks. fixed by PHP 5.2
Comment #24
BerdirSort of subscribe, I do have a php53 test environment locally and should be able to provide a patch within a few days.
Comment #25
mlmoseley CreditAttribution: mlmoseley commentedI'm running Apache and PHP 5.3.0 on OS X Leopard, and I get this error all the time. I get that it's a stricter reporting problem with PHP 5.3, but I don't have a clear idea of how to fix it without touching core, which I'm not going to do. Any ideas anyone?
--Marshall
Comment #26
smh67 CreditAttribution: smh67 commentedI can reproduce the problem on php 5.3 and it should, in fact, be reproducible in any php 5.3 setup. I'm really pressed for time right now, and will not be able to prepare and offer a proper patch. As previous posts have pointed out, the main problem is that a number of functions expect their parameters by reference (&$parameter_name) while being called by value (most importantly: being called through module_invoke_all, which does not seem to offer call-by-reference).
For my own setup, I have used a workaround similar to the one linked in comment 16 above, replacing the module_invoke_all by a custom call. My function now looks like this:
Generally, the problem looks like one that would need to be addressed more fundamentally by a maintainer (or the community, of course). This would involve checking if call-by-reference is actually needed (for example, in the user_relationships_ui.module some calls do not seem to require call-by-reference and changing their signature has solved the problem there for me) and eventually either changing the function or changing the place where the function gets called.
Sorry I don't have time for a more thorough analysis right now. If people encountering the same problem can successfully employ the code above to reduce the number of error messages this should probably help others to work on this issue more fundamentally.
Comment #27
Berdir@smh67: Youre change is not a workaround, it's the correct solution. module_invoke_all() cannot be used for hooks that contain by reference params. Since we only have two fixed arguments in this case, we don't even need call_user_func_array(). $function($type, $relationship) is much faster and simpler.
Additionally, theme() functions are not allowed to have by reference arguments, that it simply not possible, nor necessary. So I just removed these. Note that this *never* worked, older PHP versions just silently use by value, the only difference is that php 5.3 issues a warning and sets the argument to NULL.
Comment #28
alex.k CreditAttribution: alex.k commentedCommitted http://drupal.org/cvs?commit=332940. Many thanks!
Comment #30
TmaX-2 CreditAttribution: TmaX-2 commentedThank you Berdir your patch worked fine!
Comment #31
hip CreditAttribution: hip commentedWell I'm not sure if I get the whole picture but that's what I get from this thread (and from having the (almost) same problem):
PHP doesn't allow/recommend functions with one of its parameters defined as a reference
PHP 5.3 installed with XAMPP is configured to have: error_reporting = E_ALL | E_STRICT and display_errors = On
some different Drupal modules do not strictly stick to PHP 5 recommendations
All these 3 points make people who have XAMPP installed for development server to get warning messages.
Quite a few solutions are given in this thread but for what I get to understand, 2 can be recommended and only one of them is the more appropriate:
1.- Temp solution: Set up PHP modifying the php.ini file lowering the error reporting level. We'll avoid the warning message to appear
2.- Recommended: Find the 'affected' modules (*), open a issue for each one and wait for it to be repaired
(*) My 'affected' module is 'admin menu' and not 'User Relationships'
I hope this will help and will appreciate any amending to my explanation (for I may be wrong indeed).
Comment #32
Berdir1. is not a solution, these errors usually totally break the functionality, you can't simply hide them.
Apart from that, I have no clue how that is related to this issue. The errors in UR have been fixed.
Comment #33
ari-meetai CreditAttribution: ari-meetai commentedInteresting, I wonder how this will be reflected on the rest of the modules with similar issues - Gmap, for instance.
Comment #34
DreeStyler CreditAttribution: DreeStyler commented#7 neim
excellent work, thank you
Apache
MySQL database 5.1.41
PHP 5.3.1