I was getting warnings of the type 'Parameter n to function_name() expected to be a reference, value
given in /path/to/file/ on line m/.' especially with theme functions but ignoring them. When I loaded the new 6.x-2.x version I noticed that "Add a new scale" page is broken. I believe the warning messages in that case results in wrong behavior. These kind of warning messages resulting from PHP 5.3 were fixed in Drupal 6 core but they still exist in many contrib modules.

I am not sure how to fix this for this module but here is the relevant issue and patch for the core:

http://drupal.org/node/360605

To reproduce just use the module with PHP 5.3.

CommentFileSizeAuthor
#4 gradebook_php53fixes.patch2.07 KBberdir

Comments

humanoc’s picture

I am having the same problem and I don't know how to solve it.
There are a lot of patches over here, but I don't find any for these issues.

MGN’s picture

Thanks for reporting this. I haven't started working with php 5.3, so I don't have a fix for this right now. I will look into it and see what I can do. If anyone else understands this problem, please post a patch.

pembeci’s picture

I am still not sure how to solve this in the best way but see #3 at #615058: Parameter 1 to admin_menu_admin_menu() expected to be a reference for a possible way of fixing this. Other solutions I saw at other issues simply removes the reference (&) from function arguments but this one seems like a better solution.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

@3

The correct fix depends on the actual error. For theme functions, it is absolutely correct and necessary to remove the &. theme functions cannot receive arguments by reference. They never could (PHP 5.2 just passes values silently by value).

The attached patch fixes three theme functions, couldn't find any more php 5.3 related issues but I don't use nor know the module. If you have more errors, post them here together with an way to reproduce them and I'll fix it.

MGN’s picture

Thanks for the patch. I am going through the code and testing these changes and others to verify compatibility with php 5.3 and php < 5.3. I'll patch the 6.x-2.x-dev version as soon as I can. Thanks again!

MGN’s picture

Status: Needs review » Fixed

I've verified that Berdir's patch fixes the broken committed the broken Add a new scale page with php 5.3, and everything still appears to work fine with php 5.1 as well.

Committed to 6.x-2.x-dev for further testing. I know there are other adjustments that need to be made and will commit those fixes as I find them.

@pembeci, please try the latest version and let me know if this fixes the problem that you reported...I think it will so I am marking this fixed for now.

Status: Fixed » Closed (fixed)
Issue tags: -PHP 5.3, -call by reference

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