diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/config.php | 11 | ||||
-rwxr-xr-x | classes/db.php | 4 | ||||
-rwxr-xr-x | classes/feeditem/common.php | 1 | ||||
-rwxr-xr-x | classes/feeds.php | 2 | ||||
-rwxr-xr-x | classes/logger/sql.php | 2 | ||||
-rwxr-xr-x | classes/pluginhost.php | 5 | ||||
-rw-r--r-- | classes/pref/prefs.php | 2 | ||||
-rw-r--r-- | classes/pref/users.php | 2 | ||||
-rw-r--r-- | classes/urlhelper.php | 11 |
9 files changed, 15 insertions, 25 deletions
diff --git a/classes/config.php b/classes/config.php index be4ecde36..53a31b61c 100644 --- a/classes/config.php +++ b/classes/config.php @@ -234,10 +234,9 @@ class Config { private static $instance; private $params = []; - private $schema_version = null; private $version = []; - /** @var Db_Migrations $migrations */ + /** @var Db_Migrations|null $migrations */ private $migrations; public static function get_instance() : Config { @@ -255,10 +254,10 @@ class Config { $ref = new ReflectionClass(get_class($this)); foreach ($ref->getConstants() as $const => $cvalue) { - if (isset($this::_DEFAULTS[$const])) { - $override = getenv($this::_ENVVAR_PREFIX . $const); + if (isset(self::_DEFAULTS[$const])) { + $override = getenv(self::_ENVVAR_PREFIX . $const); - list ($defval, $deftype) = $this::_DEFAULTS[$const]; + list ($defval, $deftype) = self::_DEFAULTS[$const]; $this->params[$cvalue] = [ self::cast_to($override !== false ? $override : $defval, $deftype), $deftype ]; } @@ -383,7 +382,7 @@ class Config { } private function _add(string $param, string $default, int $type_hint) { - $override = getenv($this::_ENVVAR_PREFIX . $param); + $override = getenv(self::_ENVVAR_PREFIX . $param); $this->params[$param] = [ self::cast_to($override !== false ? $override : $default, $type_hint), $type_hint ]; } diff --git a/classes/db.php b/classes/db.php index a09c44628..7b669cf32 100755 --- a/classes/db.php +++ b/classes/db.php @@ -4,9 +4,7 @@ class Db /** @var Db $instance */ private static $instance; - private $link; - - /** @var PDO $pdo */ + /** @var PDO|null $pdo */ private $pdo; function __construct() { diff --git a/classes/feeditem/common.php b/classes/feeditem/common.php index b4774941f..18afeaa94 100755 --- a/classes/feeditem/common.php +++ b/classes/feeditem/common.php @@ -190,7 +190,6 @@ abstract class FeedItem_Common extends FeedItem { }, $tmp); // remove empty values - // @phpstan-ignore-next-line $tmp = array_filter($tmp, 'strlen'); asort($tmp); diff --git a/classes/feeds.php b/classes/feeds.php index ea9158949..987123a21 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -5,8 +5,6 @@ class Feeds extends Handler_Protected { const NEVER_GROUP_FEEDS = [ -6, 0 ]; const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; - private $params; - private $viewfeed_timestamp; private $viewfeed_timestamp_last; diff --git a/classes/logger/sql.php b/classes/logger/sql.php index 784ebef31..0f6177a5b 100755 --- a/classes/logger/sql.php +++ b/classes/logger/sql.php @@ -1,8 +1,6 @@ <?php class Logger_SQL implements Logger_Adapter { - private $pdo; - function __construct() { $conn = get_class($this); diff --git a/classes/pluginhost.php b/classes/pluginhost.php index f067543bb..b506a957a 100755 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -13,7 +13,6 @@ class PluginHost { private $api_methods = array(); private $plugin_actions = array(); private $owner_uid; - private $last_registered; private $data_loaded; private static $instance; @@ -383,7 +382,7 @@ class PluginHost { if (!isset($this->plugins[$class])) { try { - if (file_exists($file)) require_once $file; + require_once $file; } catch (Error $err) { user_error($err, E_USER_WARNING); continue; @@ -404,8 +403,6 @@ class PluginHost { _bind_textdomain_codeset($class, "UTF-8"); } - $this->last_registered = $class; - try { switch ($kind) { case $this::KIND_SYSTEM: diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index cb666e945..c47a99469 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -1325,7 +1325,7 @@ class Pref_Prefs extends Handler_Protected { } function activateprofile() { - $id = (int) $_REQUEST['id'] ?? 0; + $id = (int) ($_REQUEST['id'] ?? 0); $profile = ORM::for_table('ttrss_settings_profiles') ->where('owner_uid', $_SESSION['uid']) diff --git a/classes/pref/users.php b/classes/pref/users.php index 76a879efd..aeba296b2 100644 --- a/classes/pref/users.php +++ b/classes/pref/users.php @@ -167,7 +167,7 @@ class Pref_Users extends Handler_Administrative { $user->created = Db::NOW(); $user->save(); - if ($new_uid = UserHelper::find_user_by_login($login)) { + if (!is_null(UserHelper::find_user_by_login($login))) { print T_sprintf("Added user %s with password %s", $login, $new_password); } else { diff --git a/classes/urlhelper.php b/classes/urlhelper.php index 0e4834b72..4d11b5a4d 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -162,8 +162,12 @@ class UrlHelper { $context = stream_context_create($context_options); + // PHP 8 changed the second param from int to bool, but we still support PHP >= 7.1.0 + // @phpstan-ignore-next-line $headers = get_headers($url, 0, $context); } else { + // PHP 8 changed the second param from int to bool, but we still support PHP >= 7.1.0 + // @phpstan-ignore-next-line $headers = get_headers($url, 0); } @@ -275,7 +279,7 @@ class UrlHelper { curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : Config::get(Config::FILE_FETCH_CONNECT_TIMEOUT)); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : Config::get(Config::FILE_FETCH_TIMEOUT)); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir") && $followlocation); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $followlocation); curl_setopt($ch, CURLOPT_MAXREDIRS, 20); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @@ -283,6 +287,7 @@ class UrlHelper { curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : Config::get_user_agent()); curl_setopt($ch, CURLOPT_ENCODING, ""); + curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null"); if ($http_referrer) curl_setopt($ch, CURLOPT_REFERER, $http_referrer); @@ -306,10 +311,6 @@ class UrlHelper { } - if (!ini_get("open_basedir")) { - curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null"); - } - if (Config::get(Config::HTTP_PROXY)) { curl_setopt($ch, CURLOPT_PROXY, Config::get(Config::HTTP_PROXY)); } |