Skip to content

Commit fcda8a1

Browse files
committed
PHP 8: Fix major compatibility issues
PHP8 deprecated, that class member variables can be created outside the class definition or constructor, which prevented the code to run at all. Additionally the error handling has changed, which has lead to multiple other errors during the runtime. Finally, strftime was deprecated in PHP 8.1.
1 parent 25081b0 commit fcda8a1

13 files changed

+956
-910
lines changed

index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
'conference' => new GenericConference(),
8888
));
8989

90-
if(startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
90+
if(isset($GLOBALS['CONFIG']['BASEURL']) && startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
9191
{
9292
$tpl->set(array(
9393
'httpsurl' => forceslash(forceslash('https:'.$GLOBALS['CONFIG']['BASEURL']).@$GLOBALS['MANDATOR']).forceslash($route).url_params(),
@@ -128,7 +128,7 @@
128128
exit;
129129
}
130130

131-
@list($mandator, $route) = explode('/', $route, 2);
131+
list($mandator, $route) = array_pad(explode('/', $route, 2), 2, "");
132132
if(!$mandator)
133133
{
134134
// root requested

lib/PhpTemplate.php

+2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ function h($s)
1313
class PhpTemplate
1414
{
1515
private $data = array();
16+
public $file;
1617

1718
public function __construct($file)
1819
{
1920
$this->file = $file;
21+
$this->data["naked"] = false;
2022
}
2123

2224
public function set($___data = array())

lib/helper.php

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ function joinpath($parts)
3636

3737
function forceslash($url)
3838
{
39+
if ($url == NULL) {
40+
$url = "";
41+
}
3942
$url = rtrim($url, '/');
4043
if(strlen($url) > 0)
4144
$url .= '/';

0 commit comments

Comments
 (0)