[Pkg-mediawiki-devel] Bug#579822: php 5.3 issues in MediaWiki extensions

Thorsten Glaser tg at mirbsd.de
Sat Jul 17 15:53:21 UTC 2010


Hi again!

After some more digging, I found this:

┌──┤ Anyway here is reprinted for you what Skizzerz wrote:
│
│PHP 5.3 and extensions
│
│------------------------------------------------------------------
│
│Many users have been reporting errors with an error message
│"Detected bug in an extension! Hook xxxxxxx failed to return a
│value; should return true to continue hook processing or false to
│abort."
│
│For many extensions, especially those marked as "stable" on their
│extension page on mediawiki.org, the real reason behind this error
│is a lot trickier.
│
│[…]the real issue is that PHP 5.3 […] is much more strict about
│certain things than PHP 5.2 is. Therefore, in order to fix this
│error, we need to modify the extension code so that PHP 5.3 no
│longer complains about it.
│
│1. Figure out which hook is breaking. This is mentioned in the
│error message (Hook xxxxxxx).
│
│2. Find the manual page on that hook in mediawiki.org. You can get
│there either via a search or by directly modifying this URL:
│http://www.mediawiki.org/wiki/Manual:Hooks/Xxxxxxx
│
│3. […]What you do need to know is contained in the infobox of that
│manual page. The very first block of code is labeled "Define
│function:". You will notice inside of the parenthesis many things
│in bold. Take note that some of these in the list start with $ and
│others start with &$. Write down the positions of each one (for
│example: 1 is $, 2 is $, 3 is $, 4 is &$, and 5 is $).
│
│4. [edit extension…] Near the top of the extension file there
│should be a line or more saying $wgHooks["Xxxxxxx"][] = "yyyyyyy".
│Find the line that corresponds to the hook you are having issues
│with, and then note what the yyyyyyy is.
│
│5. Search for "function yyyyyyy" inside of the extension files (it
│might not be in the same one). You will notice that it also has
│parenthesis after it and a few things beginning with $ and &$
│inside of the parenthesis. Match what you wrote down earlier with
│these (for example, the ones inside of the parenthesis might be: 1
│is $, 2 is $, 3 is $, 4 is &$, and 5 is &$). In this fictional
│example, you will notice that the 5th one in the list on the
│manual page is just $, yet the 5th one here is &$.
│
│6. Change all of them to match what it says on the manual page, so
│in the example above the 5th would would become $.

This looks to me like follows: PHP functions can be defined with
an API (by-value vs. by-reference), which has been possible but
not enforced by PHP <= 5.2 but is now enforced. Many extensions
have been sloppy in adhering to the API, and your fix_579822.patch
seems to do the right thing. (Please correct me if I’m wrong).

However, there are two things I don’t understand either: first,
the excerpt goes on like this:

│Please note that the necessity of this hack is only temporary. The
│developers are working on correcting all of these issues with PHP
│5.3 so that future upgrades do not require any editing of
│extension files. If you are not comfortable with editing extension
│files, then simply uninstall the extension and wait for its next
│upgrade, which should contain the fix(es) mentioned above.

Second, you already wrote “Also, if this a a real fix, why is it not
commited in the sources then ?” which I was wondering as well.

Maybe we should get some of the MediaWiki developers to shed insight
on this not in a web forum or somesuch but from a more professional
setting (IRC, mailing list?) – or the PHP developers. Somewhere ought
to be some definitive statement on this, no?

bye,
//mirabilos
-- 
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.		-- Coywolf Qi Hunt





More information about the Pkg-mediawiki-devel mailing list