MediaWiki content not showing, but visible when in edit mode

Posted on 11-06-2015 10:16 by graham
After moving my MediaWiki installation to another Linux server, I noticed that the content of wiki pages is not showing up. There is the menu and header, but the content of every wiki page is empty. However, when I go into the edit mode, I can see the content of the page.

The reason for this turned out to be an upgraded version of PCRE on my new server. MediaWiki 1.19 does not seem to work with PCRE 8.34+. There are three solutions for this: upgrade MediaWiki, downgrade PCRE, or patch the current MediaWiki installation.

I went for the third option according to this article. The patch was to edit the file includes/MagicWord.php with the following code:
function getBaseRegex() {
if ( is_null( $this->baseRegex ) ) {
$this->baseRegex = array( 0 => '', 1 => '' );
foreach ( $this->names as $name ) {
$magic = MagicWord::get( $name );
$case = intval( $magic->isCaseSensitive() );
foreach ( $magic->getSynonyms() as $i => $syn ) {
$group = "(?P<{$i}_{$name}>" . preg_quote( $syn, '/' ) . ')';

// Group name must start with a non-digit in PCRE 8.34+
$it = strtr( $i, '0123456789', 'abcdefghij' );
$group = "(?P<{$it}_{$name}>" . preg_quote( $syn, '/' ) . ')';

if ( $this->baseRegex[$case] === '' ) {
$this->baseRegex[$case] = $group;
} else {
$this->baseRegex[$case] .= '|' . $group;
}
}
}
}
return $this->baseRegex;
}

The changed lines are:
$group = "(?P<{$i}_{$name}>" . preg_quote( $syn, '/' ) . ')';

// Group name must start with a non-digit in PCRE 8.34+
$it = strtr( $i, '0123456789', 'abcdefghij' );
$group = "(?P<{$it}_{$name}>" . preg_quote( $syn, '/' ) . ')';
Comments

 

Add comment

Has this tutorial been helpful to you? Or do you see anything wrong? We appreciate your opinion!
Your comment:
Show formatting hints
HTML is disallowed, but in your text you can use the following markup
  • [code][/code] for a block of code
  • [tt][/tt] for inline code
  • [link]link href|link anchor[/link] for links
  • [b][/b] for bold text
Email:
+ Ask a question
If you have a technical question related to programming and computers, ask it here. Other users will help you solve it!
Unanswered questions
Share your knowledge by helping others solve their problems