Jump to content

Topic on Extension talk:Widgets

Parse error: syntax error, unexpected T_FUNCTION on WidgetRenderer.php on line 142

3
Kaczorowsky (talkcontribs)

I get this error after installing the extension. The portion of the code where the error occurs is listed bellow (note the comment indicating the line with the error) Any ideas on this?

Im using MediaWiki 1.19.15 and PHP 5.2.6

public static function processEncodedWidgetOutput( &$out, &$text ) {
	// Find all hidden content and restore to normal
	$text = preg_replace_callback(
		'/ENCODED_CONTENT ' . self::$mRandomString . '([0-9a-zA-Z\/+]+=*)* END_ENCODED_CONTENT/',
		function( $matches ) { 	//this is line 142, where the error happens
			return base64_decode( $matches[1]);
		},
		$text
	);

	return true;
}
Yaron Koren (talkcontribs)

I'm pretty sure it's because you're using PHP 5.2, an old version (from 2006) that doesn't fully support preg_replace_callback(); you should upgrade if possible.

Kaczorowsky (talkcontribs)

Thanks for the reply. Unfortunatelly upgrading is not an option for now. I believe there is no way to workaround this also. So i'll just give up on this issue until i have the proper environment to run the extension.

Reply to "Parse error: syntax error, unexpected T_FUNCTION on WidgetRenderer.php on line 142"