Reputation: 130
When trying to install the latest Invision Power Board on my Xampp Apache server, I get this error:
Fatal error: Cannot make static method XMLReader::open() non static in class IPS\Xml\_XMLReader in D:\xampp\htdocs\PATH_TO_IPS_INSTALL\system\Xml\XMLReader.php on line 34
This is an excerpt from the extensions section of my PHP.ini
extension=bz2
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
extension=exif
extension=mysqli
extension=oci8_12c
extension=odbc
extension=openssl
extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop
extension=soap
extension=sockets
extension=sodium
extension=sqlite3
extension=tidy
extension=xsl
What can I do to get rid of the error?
Edit: Here's the content starting at line 23
class _XMLReader extends \XMLReader
{
/**
* Open a file or URL with XMLReader to read it
*
* @param string $uri The URI/path to open
* @param string $encoding The encoding to use, or NULL
* @param int $options Bitmask of LIBXML_* constants
* @return bool
* @note We are disabling network access while loading the content to prevent XXE
*/
public function open( $uri, $encoding=NULL, $options=0 )
{
if( $options === 0 )
{
$options = LIBXML_NONET;
}
return parent::open( $uri, $encoding, $options );
}
}
Upvotes: 0
Views: 636
Reputation: 9886
The error appears to be that the child class is trying to overload the static open()
method with a non-static open()
method. From https://www.php.net/manual/en/migration80.incompatible.php :
XMLReader
XMLReader::open() and XMLReader::xml() are now static methods. They can still be called as instance methods, but inheriting classes need to declare them as static if they override these methods.
Since this is a change in PHP 8.0.0, my guess is that you are using a version of PHP >= 8.0.0 that is incompatible with PowerBoard.
There may be a way to change this piece of code to work on 8.0.0, but my guess is that you will probably encounter more problems other than this one if you are using an unsupported major version.
My advice would be to install whatever Power Board's recommended version of PHP is. I tried to find what that version is on the Power Board site, but a brief look didn't turn up anything.
Upvotes: 1