WIKI - parse error

Hello,

I am very new to PHP, and I have a wiki that returns this error:

Parse error: syntax error, unexpected T_FUNCTION, expecting T_VARIABLE…/wiki/includes/AutoLoader.php on line 587

Here is the code from line 543 to 609

[php]class AutoLoader {
/**
* autoload - take a class name and attempt to load it
*
* @param string $className Name of class we’re looking for.
* @return bool Returning false is important on failure as
* it allows Zend to try and look in other registered autoloaders
* as well.
*/
static function autoload( $className ) {
global $wgAutoloadClasses, $wgAutoloadLocalClasses;

	if ( isset( $wgAutoloadLocalClasses[$className] ) ) {
		$filename = $wgAutoloadLocalClasses[$className];

	} elseif ( isset( $wgAutoloadClasses[$className] ) ) {
		$filename = $wgAutoloadClasses[$className];
	} else {
		# Try a different capitalisation
		# The case can sometimes be wrong when unserializing PHP 4 objects
		$filename = false;
		$lowerClass = strtolower( $className );
		foreach ( $wgAutoloadLocalClasses as $class2 => $file2 ) {
			if ( strtolower( $class2 ) == $lowerClass ) {
				$filename = $file2;
			}
		}
		if ( !$filename ) {
			if( function_exists( 'wfDebug' ) ) 	
				wfDebug( "Class {$className} not found; skipped loading\n" );
			# Give up
			return false;
		}
	}

	# Make an absolute path, this improves performance by avoiding some stat calls
	if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) != ':' ) {
		global $IP;
		$filename = "$IP/$filename";
	}{
	require( $filename );
	return true;
}

static function loadAllExtensions( $className ) {
	global $wgAutoloadClasses, $wgAutoloadClasses;

}
foreach( $wgAutoloadClasses as $class => $file ) {
if( !( class_exists( $class, false ) || interface_exists( $class, false ) ) ) {
require( $file );
}
}
}
}

function wfLoadAllExtensions() {
AutoLoader::loadAllExtensions();
}

if ( function_exists( ‘spl_autoload_register’ ) ) {
spl_autoload_register( array( ‘AutoLoader’, ‘autoload’ ) );
} else {
function __autoload( $class ) {
AutoLoader::autoload( $class );
}
}
?>[/php]

here is the line in question:

[php] static function loadAllExtensions( $className ) {[/php]

Hi there,

I didn’t read into the script to be honest, but I put it locally and deleting the “static” from that line fixed it… if that’s not an option let me know and I’ll look into it more.

Thank you for your help, it’s greatly appreciated!

That did fix that error, but now Im showing this error in it’s place:

Warning: require(/home/revo/public_html/members/wiki/includes/Article.php) [function.require]: failed to open stream: Permission denied in /home/revo/public_html/members/wiki/includes/AutoLoader.php on line 583

Fatal error: require() [function.require]: Failed opening required ‘/home/revo/public_html/members/wiki/includes/Article.php’ (include_path=’/home/revo/public_html/members/wiki:/home/revo/public_html/members/wiki/includes:/home/revo/public_html/members/wiki/languages:.:/usr/lib/php:/usr/local/lib/php’) in /home/revo/public_html/members/wiki/includes/AutoLoader.php on line 583

The two [function require] are “Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.”

Anthony

Sponsor our Newsletter | Privacy Policy | Terms of Service