Jesus Taiwan

Fixing Mediawiki 1.6 when upgrading PHP from 5.2 to 5.3

From 耶穌台灣

目錄

Fixing Mediawiki 1.6 when upgrading PHP from 5.2 to 5.3

The FreeBSD's port php5 was updated from 5.2.12 to 5.3.2 on Apr 9 2010. It will get a syntax error when running Mediawiki 1.6 in PHP 5.3:

syntax error, unexpected T_NAMESPACE, expecting T_STRING in /usr/local/www/wiki/includes/Namespace.php on line 46

This problem was caused by "Namespace", which used as php class name in Mediawiki 1.6, being a reserved keyword since PHP 5.3. To fixing this errer, you must rename Namespace to MWNamespace.

  • Note: The Midiawiki already renamed Namespace to MWNamespace since branch 1.13.

HOW TO

Rename class

Open /includes/Namespace.php

Find: (Line 46)

class Namespace {

Replace with:

class MWNamespace {

Check related files

Check all files in the Mediawiki folder for references to Namespace:: and renaming that to MWNamespace::.

The related files in Mediawiki 1.6 as following:

Search "Namespace::" (18 hits in 10 files)
/includes/Export.php (1 hits)
/includes/ImageGallery.php (1 hits)
/includes/Namespace.php (3 hits)
/includes/Parser.php (1 hits)
/includes/RecentChange.php (1 hits)
/includes/SkinTemplate.php (1 hits)
/includes/SpecialWatchlist.php (1 hits)
/includes/Title.php (6 hits)
/maintenance/FiveUpgrade.inc (2 hits)
/maintenance/generateSitemap.php (1 hits)