Skip to content

A free, self-hostable news aggregator…

Fixes for PHPStan 2.1.42 (#8627)

Alexandre Alapetite1f614e5b4610
diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php
index 910d10613..f7671242a 100644
--- a/app/Services/ImportService.php
+++ b/app/Services/ImportService.php
@@ -455,12 +455,13 @@ class FreshRSS_Import_Service {
$categories_elements = [];
$categories_to_feeds = [];
- if ($parent_category_name === '' && isset($outline['category']) && is_array($outline['category'])) {
+ if ($parent_category_name === '' && is_array($outline['category'] ?? null)) {
// The outline has no parent category, but its OPML category
// attribute is set, so we use it as the category name.
// lib_opml parses this attribute as an array of strings, so we
// rebuild a string here.
- $parent_category_name = implode(', ', $outline['category']);
+ $category_names = array_filter($outline['category'], 'is_string');
+ $parent_category_name = implode(', ', $category_names);
$categories_elements[$parent_category_name] = [
'text' => $parent_category_name,
];
diff --git a/app/Utils/httpUtil.php b/app/Utils/httpUtil.php
index 5b652b5f2..253c3f0cd 100644
--- a/app/Utils/httpUtil.php
+++ b/app/Utils/httpUtil.php
@@ -496,9 +496,10 @@ final class FreshRSS_http_Util {
}
public static function httpAuthUser(bool $onlyTrusted = true): string {
- $auths = array_unique(
- array_intersect_key($_SERVER, ['REMOTE_USER' => '', 'REDIRECT_REMOTE_USER' => '', 'HTTP_REMOTE_USER' => '', 'HTTP_X_WEBAUTH_USER' => ''])
- );
+ $auths = array_unique(array_filter(
+ array_intersect_key($_SERVER, ['REMOTE_USER' => '', 'REDIRECT_REMOTE_USER' => '', 'HTTP_REMOTE_USER' => '', 'HTTP_X_WEBAUTH_USER' => '']),
+ fn($value) => is_string($value) && $value !== ''
+ ));
if (count($auths) > 1) {
Minz_Log::warning('Multiple HTTP authentication headers!');
return '';
diff --git a/composer.lock b/composer.lock
index 5c60a02e1..50b17d535 100644
--- a/composer.lock
+++ b/composer.lock
@@ -245,11 +245,11 @@
},
{
"name": "phpstan/phpstan",
- "version": "2.1.40",
+ "version": "2.1.42",
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b2c7aeb83a75d8680ea5e7c9b7fca88052b766b",
- "reference": "9b2c7aeb83a75d8680ea5e7c9b7fca88052b766b",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1279e1ce86ba768f0780c9d889852b4e02ff40d0",
+ "reference": "1279e1ce86ba768f0780c9d889852b4e02ff40d0",
"shasum": ""
},
"require": {
@@ -294,7 +294,7 @@
"type": "github"
}
],
- "time": "2026-02-23T15:04:35+00:00"
+ "time": "2026-03-17T14:58:32+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",