Skip to content

Commit

Permalink
PHP 8: Fix major compatibility issues
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jbeyerstedt committed Oct 22, 2023
1 parent 25081b0 commit fcda8a1
Show file tree
Hide file tree
Showing 13 changed files with 956 additions and 910 deletions.
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
'conference' => new GenericConference(),
));

if(startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
if(isset($GLOBALS['CONFIG']['BASEURL']) && startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
{
$tpl->set(array(
'httpsurl' => forceslash(forceslash('https:'.$GLOBALS['CONFIG']['BASEURL']).@$GLOBALS['MANDATOR']).forceslash($route).url_params(),
Expand Down Expand Up @@ -128,7 +128,7 @@
exit;
}

@list($mandator, $route) = explode('/', $route, 2);
list($mandator, $route) = array_pad(explode('/', $route, 2), 2, "");
if(!$mandator)
{
// root requested
Expand Down
2 changes: 2 additions & 0 deletions lib/PhpTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ function h($s)
class PhpTemplate
{
private $data = array();
public $file;

public function __construct($file)
{
$this->file = $file;
$this->data["naked"] = false;
}

public function set($___data = array())
Expand Down
3 changes: 3 additions & 0 deletions lib/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function joinpath($parts)

function forceslash($url)
{
if ($url == NULL) {
$url = "";
}
$url = rtrim($url, '/');
if(strlen($url) > 0)
$url .= '/';
Expand Down
Loading

0 comments on commit fcda8a1

Please sign in to comment.