Fix E_NOTICES on php 8.2 master github/master
authorChristian Weiske <cweiske@cweiske.de>
Mon, 20 Nov 2023 16:04:42 +0000 (17:04 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 20 Nov 2023 16:04:42 +0000 (17:04 +0100)
www/functions.php

index ca64ed566a1b5da800dba18ea5a30bded0feab89..95694e71cbd547c7a0ee9efd2882cbcb2796f9e6 100644 (file)
@@ -39,7 +39,7 @@ function getPageUrl()
         errorInput('Content type is not text/plain but ' . $_SERVER['CONTENT_TYPE']);
     }
 
-    $parts = parse_url($pageUrl);
+    $parts = parse_url($pageUrl ?? null);
     if ($parts === false) {
         errorInput('Invalid URL in POST data');
     } else if (!isset($parts['scheme'])) {
@@ -137,6 +137,8 @@ function extractVideoUrlFromJson($json)
 
     //filter: best quality
     usort($safeFormats, function ($a, $b) {
+        $a->acodec = $a->acodec ?? null;
+        $b->acodec = $b->acodec ?? null;
         if ((($a->acodec != 'none') + ($b->acodec != 'none')) == 1) {
             return ($b->acodec != 'none') - ($a->acodec != 'none');
         }