1
0

Increase error reporting and fix a few small warnings

Signed-off-by: Markus Birth <markus@birth-online.de>
This commit is contained in:
2025-06-14 17:58:36 +01:00
parent 56100cfd10
commit 4487199f16
6 changed files with 11 additions and 8 deletions

View File

@ -843,7 +843,7 @@ function serendipity_getUriArguments($uri, $wildcard = false) {
/* Explode the path into sections, to later be able to check for arguments and add our own */
preg_match('/^'. preg_quote($serendipity['serendipityHTTPPath'], '/') . '(' . preg_quote($serendipity['indexFile'], '/') . '\?\/)?(' . ($wildcard ? '.+' : '[!;,_a-z0-9\-*\/%\+]+') . ')/i', $uri, $_res);
if (strlen($_res[2] ?? null) != 0) {
if (strlen($_res[2] ?? '') != 0) {
$args = explode('/', $_res[2]);
if ($args[0] == $indexFile || $args[0] == $serendipity['indexFile']) {
unset($args[0]);

View File

@ -1026,8 +1026,8 @@ function serendipity_smarty_init($vars = array()) {
$serendipity['smarty_vars']['head_link_stylesheet'] .= '&amp;v=' . ($serendipity['last_template_change'] ?? null);
$serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '&amp;v=' . ($serendipity['last_template_change'] ?? null);
} else {
$serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
$serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '?v=' . $serendipity['last_template_change'];
$serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . ($serendipity['last_template_change'] ?? '');
$serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '?v=' . ($serendipity['last_template_change'] ?? '');
}
}
@ -1041,7 +1041,7 @@ function serendipity_smarty_init($vars = array()) {
if (strstr($serendipity['smarty_vars']['head_link_script'], '?')) {
$serendipity['smarty_vars']['head_link_script'] .= '&amp;v=' . ($serendipity['last_template_change'] ?? null);
} else {
$serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];
$serendipity['smarty_vars']['head_link_script'] .= '?v=' . ($serendipity['last_template_change'] ?? '');
}
}

View File

@ -35,7 +35,7 @@ class ConfigContainer implements ArrayAccess
return isset($this->serendipity[$offset]);
}
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return isset($this->serendipity[$offset]) ? $this->serendipity[$offset] : null;
}

View File

@ -63,7 +63,10 @@ class PdoSqliteDatabase extends DbAbstract
// To fix that, we use a preg-regex; but that is quite performance costy.
// Either we always need to use 'SELECT a.id AS id, b.text AS text' in query,
// or the sqlite extension may get fixed. :-)
$newrow[preg_replace('@^.+\.(.*)@', '\1', $i)] = str_replace($search, $replace, $v);
if (!is_null($v)) {
$v = str_replace($search, $replace, $v);
}
$newrow[preg_replace('@^.+\.(.*)@', '\1', $i)] = $v;
}
return $newrow;

View File

@ -6,7 +6,7 @@
namespace LuckyCoin;
// FIXME: Remove when code makes sense again
error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
// Ensure vendor libraries exist
$autoload = __DIR__ . '/../vendor/autoload.php';

View File

@ -29,7 +29,7 @@ if (!headers_sent() && php_sapi_name() !== 'cli') {
session_regenerate_id(true);
@session_start();
header('X-Session-Reinit: true');
$_SESSION['SERVER_GENERATED_SID'] = $_SERVER['REMOTE_ADDR'] . $_SERVER['QUERY_STRING'];
$_SESSION['SERVER_GENERATED_SID'] = $_SERVER['REMOTE_ADDR'] . ($_SERVER['QUERY_STRING'] ?? '');
}
}