PHP5 migration problems with MediaWiki

From korrekt.org

Jump to: navigation, search

Sept 6 2007warning.pngThe date "Sept 6 2007" was not understood. . Finally, I managed to fix the annoying PHP5 problems that prevented SMW from working properly on this site.

Edit. While the below fix is still valid, the problem may have been caused not by an actual bug but by having the PHP option zend.ze1_compatibility_mode activated. Trying to install a new MediaWiki pointed me to this.

Edit 2: this was the problem and there is a simple fix. Just include the following line right at the beginning of LocalSettings.php:

ini_set("zend.ze1_compatibility_mode", false);

This also works around installation troubles – in this case you have to put the line into the script in the config directory. Of course, this is not a definite fix, since there are multiple ways of starting parts of MediaWiki, some of which may not use LocalSettings.php. Consider it as a possible workaround while your server admin fixes the global PHP settings.


The issue arose with the Debian PHP5 backport ("5.2.3-0.dotdeb.0") that this site is running on. The symptoms were that many tags such as <!-- ... --> and <nowiki> ... </nowiki> were broken, creating an unreadable character sequence "UNIQ...QINU" as an output. The problem was hard to analyse but, eventually, easy to fix: in Parser.php, there is a function strip() with (among others) a parameter $state in its declaration. All I had to do was to replace this with &$state.

Our PHP5 backport apparently does not implement the passing of objects as parameters properly. The parameter $state is modified within the function strip(), but this change does not affect the object that was given to the function as a parameter. Instead, PHP clones the object and modifies only the clone.

The problem might occur virtually anywhere, and I already had to insert some further & within MediaWiki's exception handling code.


Personal tools