Răsfoiți Sursa

Fixes for PHPStan 2.1.42 (#8627)

Alexandre Alapetite 1 săptămână în urmă
părinte
comite
1f614e5b46
3 a modificat fișierele cu 11 adăugiri și 9 ștergeri
  1. 3 2
      app/Services/ImportService.php
  2. 4 3
      app/Utils/httpUtil.php
  3. 4 4
      composer.lock

+ 3 - 2
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,
 			];

+ 4 - 3
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 '';

+ 4 - 4
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",