fix(player-api): tolerate null bouquets and stream icon during player login

Port of Rosmi720/XC_VM@8f41d206. Harden the streaming user-info path against
null/malformed data that caused a fatal TypeError on player login:

- ImageUtils::validateURL() accepts null/empty (nullable icon columns) → ''.
- UserRepository::decodeUserFields() tolerates already-decoded arrays, null
  columns and malformed JSON (via a shared decodeJsonField helper).
- aggregateBouquetIds() skips non-array bouquet groups (mergeBouquetGroup
  helper); getStreamingUserInfo() resolves the bouquet map from the shared
  cache / DB when the caller passes none (resolveBouquets helper).
- PlayerApiController::getOutputFormats() guards a non-iterable input and
  falls back to the full format set.

Adapted to this tree: kept the existing null-safe category_map / active_cons
handling, and split the added guards into small covered helpers to stay within
the complexity ceiling (unit test for resolveBouquets).
This commit is contained in:
AbdoAhmedElbanaa
2026-09-21 18:55:17 +03:00
committed by Divarion_D
parent a403b8b6af
commit e264443909
4 changed files with 76 additions and 32 deletions
+8
View File
@@ -135,4 +135,12 @@ final class UserRepositoryTest extends TestCase {
$this->assertNull(UserRepository::getLineById($rID), var_export($rID, true));
}
}
// A caller-supplied bouquet map is used as-is (the null path resolves from
// the shared cache / DB, exercised via the streaming endpoints).
public function testResolveBouquetsUsesCallerSuppliedMap(): void {
$rMap = array(1 => array('streams' => array(7)));
$this->assertSame($rMap, $this->call('resolveBouquets', $rMap));
$this->assertSame(array(), $this->call('resolveBouquets', array()));
}
}