Closed (fixed)
Project:
Patterns
Version:
6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jan 2009 at 21:35 UTC
Updated:
9 Feb 2009 at 21:30 UTC
Line 1794 of patterns.module is throwing a call-time-pass-by-reference warning at each page load. It doesn't look like you really need that pass-by-reference on $ref[i++], because $ref is already being passed by reference inside the array('trace' => _patterns_array_trace($ref)) in the line above.
I removed it, and it doesn't seem to be causing any problems. Want a patch?
Comments
Comment #1
vaish commentedIt seems to me that pass-by-reference is not required (I'm looking at the line 1850 in the current version) because parameters to array_unshift() are already passed by reference. However, this piece of code is recently added by Sarva and it's currently used only by views component, so maybe he could confirm that everything is fine before we remove it.
Comment #2
sarvab commentedI guess different versions of php5 allow passing in references in through array_unshift while others do not.
I'm not actually 100% sure if the reference needs to be kept there or not, but I'd like to stay on the safe side and keep it as a reference because the various keys (such as 'parent' => &$ref) pointing to different parts of the context structure could potentially get messed up if we don't.
Also, from what I've tested, array_unshift does not push variables as reference to the front of the array. I ran a little test to check that, and it was a copy of the variable instead of a reference unfortunately.
I just committed a fix that will keep things how they were but get rid of the error.
Comment #3
sarvab commentedComment #4
senpai commented#2 fix was tested by me, and working just fine. No PHP warnings. Cool!