Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

Why does Parser.php pass a value to my extension instead of a reference?

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


mickewiki at gmail

Oct 10, 2009, 12:38 AM

Post #1 of 2 (917 views)
Permalink
Why does Parser.php pass a value to my extension instead of a reference?

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/8597137082778b8a/9933d6aee588372a
/five messages down)


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


rarohde at gmail

Oct 10, 2009, 1:00 AM

Post #2 of 2 (864 views)
Permalink
Re: Why does Parser.php pass a value to my extension instead of a reference? [In reply to]

On Sat, Oct 10, 2009 at 12:38 AM, Micke Nordin <mickewiki [at] gmail> 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

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.