Handle is_callable returning false with instance methods on static types since PHP 8
See https://php.watch/versions/8.0/non-static-static-call-fatal-error
This commit is contained in:
parent
6b49aa6069
commit
f9584f09b5
1 changed files with 11 additions and 0 deletions
11
index.php
11
index.php
|
|
@ -116,6 +116,17 @@ switch ($pageCall)
|
|||
$class = $cleanName.'Page';
|
||||
if (is_callable([$class, 'display']))
|
||||
(new $class($pageCall, $pageParam))->display();
|
||||
else if (method_exists($class, 'display'))
|
||||
{
|
||||
// PHP 8 requires an instance of $class for is_callable to work
|
||||
$classInstance = new $class($pageCall, $pageParam);
|
||||
if (is_callable([$classInstance, 'display']))
|
||||
$classInstance->display();
|
||||
else if (isset($_GET['power']))
|
||||
die('$WowheadPower.register(0, '.User::$localeId.', {})');
|
||||
else // in conjunction with a proper rewriteRule in .htaccess...
|
||||
(new GenericPage($pageCall))->error();
|
||||
}
|
||||
else if (isset($_GET['power']))
|
||||
die('$WowheadPower.register(0, '.User::$localeId.', {})');
|
||||
else // in conjunction with a proper rewriteRule in .htaccess...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue