mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 08:25:55 +00:00
initial WIP for php8; bump php version requirement to 7.0
This commit is contained in:
@@ -10,10 +10,12 @@ function format_backtrace($trace) {
|
||||
|
||||
if (is_array($e["args"])) {
|
||||
foreach ($e["args"] as $a) {
|
||||
if (!is_object($a)) {
|
||||
array_push($fmt_args, $a);
|
||||
} else {
|
||||
if (is_object($a)) {
|
||||
array_push($fmt_args, "[" . get_class($a) . "]");
|
||||
} else if (is_array($a)) {
|
||||
array_push($fmt_args, "[" . truncate_string(json_encode($a), 128, "...")) . "]";
|
||||
} else {
|
||||
array_push($fmt_args, $a);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +23,11 @@ function format_backtrace($trace) {
|
||||
$filename = str_replace(dirname(__DIR__) . "/", "", $e["file"]);
|
||||
|
||||
$rv .= sprintf("%d. %s(%s): %s(%s)\n",
|
||||
$idx, $filename, $e["line"], $e["function"], implode(", ", $fmt_args));
|
||||
$idx,
|
||||
$filename,
|
||||
$e["line"],
|
||||
$e["function"],
|
||||
implode(", ", $fmt_args));
|
||||
|
||||
$idx++;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,11 @@
|
||||
function startup_gettext() {
|
||||
|
||||
# Get locale from Accept-Language header
|
||||
$lang = al2gt(array_keys(get_translations()), "text/html");
|
||||
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
|
||||
$lang = al2gt(array_keys(get_translations()), "text/html");
|
||||
} else {
|
||||
$lang = ""; // FIXME: do something with accept-to-gettext.php
|
||||
}
|
||||
|
||||
if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
|
||||
$lang = _TRANSLATION_OVERRIDE_DEFAULT;
|
||||
@@ -222,13 +226,13 @@
|
||||
/* end compat shims */
|
||||
|
||||
function get_ssl_certificate_id() {
|
||||
if ($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"]) {
|
||||
if ($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"] ?? false) {
|
||||
return sha1($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"] .
|
||||
$_SERVER["REDIRECT_SSL_CLIENT_V_START"] .
|
||||
$_SERVER["REDIRECT_SSL_CLIENT_V_END"] .
|
||||
$_SERVER["REDIRECT_SSL_CLIENT_S_DN"]);
|
||||
}
|
||||
if ($_SERVER["SSL_CLIENT_M_SERIAL"]) {
|
||||
if ($_SERVER["SSL_CLIENT_M_SERIAL"] ?? false) {
|
||||
return sha1($_SERVER["SSL_CLIENT_M_SERIAL"] .
|
||||
$_SERVER["SSL_CLIENT_V_START"] .
|
||||
$_SERVER["SSL_CLIENT_V_END"] .
|
||||
@@ -240,11 +244,11 @@
|
||||
// this is used for user http parameters unless HTML code is actually needed
|
||||
function clean($param) {
|
||||
if (is_array($param)) {
|
||||
return array_map("strip_tags", $param);
|
||||
return trim(array_map("strip_tags", $param));
|
||||
} else if (is_string($param)) {
|
||||
return strip_tags($param);
|
||||
return trim(strip_tags($param));
|
||||
} else {
|
||||
return $param;
|
||||
return trim($param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +411,8 @@
|
||||
}
|
||||
|
||||
function is_server_https() {
|
||||
return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
|
||||
return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) ||
|
||||
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https');
|
||||
}
|
||||
|
||||
function is_prefix_https() {
|
||||
@@ -577,7 +582,7 @@
|
||||
if (is_array($ttrss_version) && isset($ttrss_version['version'])) {
|
||||
$git_commit = $ttrss_version['commit'];
|
||||
$git_timestamp = $ttrss_version['timestamp'];
|
||||
$last_error = $ttrss_version['last_error'];
|
||||
$last_error = $ttrss_version['last_error'] ?? "";
|
||||
|
||||
return $ttrss_version['version'];
|
||||
} else {
|
||||
|
||||
@@ -70,8 +70,8 @@
|
||||
array_push($errors, "Please don't run this script as root.");
|
||||
}
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.6.0', '<')) {
|
||||
array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
array_push($errors, "PHP version 7.0.0 or newer required. You're using " . PHP_VERSION . ".");
|
||||
}
|
||||
|
||||
if (!class_exists("UConverter")) {
|
||||
@@ -125,14 +125,14 @@
|
||||
if (SELF_URL_PATH == "http://example.org/tt-rss/") {
|
||||
$hint = $ref_self_url_path ? "(possible value: <b>$ref_self_url_path</b>)" : "";
|
||||
array_push($errors,
|
||||
"Please set SELF_URL_PATH to the correct value for your server $hint");
|
||||
"Please set SELF_URL_PATH to the correct value for your server: $hint");
|
||||
}
|
||||
|
||||
if ($ref_self_url_path &&
|
||||
(!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) &&
|
||||
SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) {
|
||||
array_push($errors,
|
||||
"Please set SELF_URL_PATH to the correct value detected for your server: <b>$ref_self_url_path</b>");
|
||||
"Please set SELF_URL_PATH to the correct value detected for your server: <b>$ref_self_url_path</b> (you're using: <b>" . SELF_URL_PATH . "</b>)");
|
||||
}
|
||||
|
||||
if (!is_writable(ICONS_DIR)) {
|
||||
|
||||
Reference in New Issue
Block a user