I have a bug report for a user of my Google Wave extension:
http://www.mediawiki.org/wiki/Extension:GoogleWave
http://code.google.com/p/micke/source/browse/GoogleWave/GoogleWave.php (source)
It seems Parser.php sends the parser object to my function as a value($parser) rather than as a reference (&$parser):
[Tue Oct 06 16:57:53 2009] [error] [client x.x.x.x.] PHP Warning: Parameter 3 to waveRender() expected to be a reference, value given in C:\Apache2.2\htdocs\mediawiki\includes\parser\Parser.php on line 3243, referer: ...
Why is this? I don't get an error like this in any of my test installations (although I have never tried it in a Windows environment). Googleing gives me nothing...
My questions are these: Why does this happen? Is it something with the version of PHP?
What are the benefits in my case of wanting the parser object as a reference instead of a value? That is, should I do: function waveRender($input, $argv, $parser)
rather than: function waveRender($input, $argv, &$parser)
I just set it up the way I did after reading the docs on http://mediawiki.org where it alwas seems to be passed by reference.
The users bug report can be found here btw: http://groups.google.com/group/google-wave-api/browse_thread/thread/85971370... /five messages down)
On Sat, Oct 10, 2009 at 12:38 AM, Micke Nordin mickewiki@gmail.com wrote:
I have a bug report for a user of my Google Wave extension:
http://www.mediawiki.org/wiki/Extension:GoogleWave
http://code.google.com/p/micke/source/browse/GoogleWave/GoogleWave.php (source)
It seems Parser.php sends the parser object to my function as a value($parser) rather than as a reference (&$parser):
[Tue Oct 06 16:57:53 2009] [error] [client x.x.x.x.] PHP Warning: Parameter 3 to waveRender() expected to be a reference, value given in C:\Apache2.2\htdocs\mediawiki\includes\parser\Parser.php on line 3243, referer: ...
Why is this? I don't get an error like this in any of my test installations (although I have never tried it in a Windows environment). Googleing gives me nothing...
My questions are these: Why does this happen? Is it something with the version of PHP?
<snip>
PHP 4 and PHP 5 handle objects as function parameters differently. Mediawiki now considers PHP 5.0 or later as a prerequisite (5.1 or later recommended). The warning you quote is a plausible consequence of using PHP 4 under certain circumstances, so that is the first thing I would check.
-Robert Rohde
Robert Rohde <rarohde <at> gmail.com> writes:
PHP 4 and PHP 5 handle objects as function parameters differently. Mediawiki now considers PHP 5.0 or later as a prerequisite (5.1 or later recommended). The warning you quote is a plausible consequence of using PHP 4 under certain circumstances, so that is the first thing I would check.
Right, I'll see if I can get a hold of the guy again. Thanks for that.
Is there a notable difference between passing the parser object by reference rather than as a value in this case though? I mean, if I can support PHP4 with my extension with out any (notable) differences I could just as easily pass the object as a value instead. I don't notice an difference in performance when I try it...
/Micke
On Sat, Oct 10, 2009 at 4:25 AM, Micke Nordin mickewiki@gmail.com wrote:
Robert Rohde <rarohde <at> gmail.com> writes:
PHP 4 and PHP 5 handle objects as function parameters differently. Mediawiki now considers PHP 5.0 or later as a prerequisite (5.1 or later recommended). The warning you quote is a plausible consequence of using PHP 4 under certain circumstances, so that is the first thing I would check.
Right, I'll see if I can get a hold of the guy again. Thanks for that.
Is there a notable difference between passing the parser object by reference rather than as a value in this case though? I mean, if I can support PHP4 with my extension with out any (notable) differences I could just as easily pass the object as a value instead. I don't notice an difference in performance when I try it...
/Micke
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
There's no point in targeting PHP4. Mediawiki doesn't support it anymore.
-Chad
Micke Nordin writes:
Robert Rohde <rarohde <at> gmail.com> writes:
PHP 4 and PHP 5 handle objects as function parameters differently. Mediawiki now considers PHP 5.0 or later as a prerequisite (5.1 or later recommended). The warning you quote is a plausible consequence of using PHP 4 under certain circumstances, so that is the first thing I would check.
Right, I'll see if I can get a hold of the guy again. Thanks for that.
Is there a notable difference between passing the parser object by reference rather than as a value in this case though? I mean, if I can support PHP4 with my extension with out any (notable) differences I could just as easily pass the object as a value instead. I don't notice an difference in performance when I try it...
/Micke
You can't support PHP5 in mediawiki. The warning you get was added on PHP 5.3 and doesn't affect that code works OK. You should remove the reference to make the warning go away.
wikitech-l@lists.wikimedia.org