Fix 11 errors

This commit is contained in:
Art4 2025-02-24 15:15:26 +00:00
commit ca3d98b9f5
6 changed files with 15 additions and 18 deletions

View file

@ -7,6 +7,7 @@
namespace Friendica\Util;
use Exception;
use Friendica\Core\Protocol;
use Friendica\Database\Database;
use Friendica\Database\DBA;
@ -213,7 +214,7 @@ class HTTPSignature
$headers = [];
foreach ($matches as $match) {
$headers[$match[1]] = trim($match[2] ?: $match[3], '"');
$headers[$match[1]] = trim((string) $match[2], '"');
}
// if the header is encrypted, decrypt with (default) site private key and continue
@ -537,14 +538,12 @@ class HTTPSignature
if (!empty($uid)) {
$owner = User::getOwnerDataById($uid);
if (!$owner) {
return;
}
} else {
$owner = User::getSystemAccount();
if (!$owner) {
return;
}
if (!$owner) {
throw new Exception('Could not find owner for uid ' . $uid);
}
if (!empty($owner['uprvkey'])) {

View file

@ -243,14 +243,11 @@ class JsonLD
return json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
}
/**
* Fetches an element array from a JSON array
*
* @param $array
* @param $element
* @param $key
*
* @return array fetched element
* @return array|null fetched element or null
*/
public static function fetchElementArray($array, $element, $key = null, $type = null, $type_value = null)
{

View file

@ -26,13 +26,13 @@ class ReversedFileReader implements \Iterator
/** @var int */
private $pos = -1;
/** @var array */
/** @var array|null */
private $buffer = null;
/** @var int */
private $key = -1;
/** @var string */
/** @var string|null */
private $value = null;
/**
@ -53,6 +53,7 @@ class ReversedFileReader implements \Iterator
$this->buffer = null;
$this->key = -1;
$this->value = null;
return $this;
}

View file

@ -209,7 +209,7 @@ class Strings
{
// If this method is called for an infinite (== unlimited) amount of bytes:
if ($bytes == INF) {
return INF;
return 'INF';
}
$units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
@ -509,7 +509,7 @@ class Strings
function ($matches) use ($blocks) {
$return = $matches[0];
if (isset($blocks[intval($matches[1])])) {
$return = $blocks[$matches[1]];
$return = $blocks[intval($matches[1])];
}
return $return;
},

View file

@ -405,7 +405,7 @@ class Temporal
*/
public static function getDaysInMonth(int $y, int $m): int
{
return date('t', mktime(0, 0, 0, $m, 1, $y));
return (int) date('t', mktime(0, 0, 0, $m, 1, $y));
}
/**

View file

@ -184,7 +184,7 @@ class XML
* @param integer $recursion_depth recursion counter for internal use - default 0
* internal use, recursion counter
*
* @return array | string The array from the xml element or the string
* @return array|string|null The array from the xml element or the string
*/
public static function elementToArray($xml_element, int &$recursion_depth = 0)
{