mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-24 16:25:00 -04:00
Fix some PHP 8.1 warnings (#4012)
* Fix some PHP 8.1 warnings The proper fix will have to wait till be drop PHP7. #fix https://github.com/FreshRSS/FreshRSS/issues/4010 * Another PHP8.1 fix
This commit is contained in:
committed by
GitHub
parent
b21fe199ed
commit
28cff8a0df
@@ -28,6 +28,8 @@ abstract class Minz_Pdo extends PDO {
|
||||
return $this->autoPrefix($statement);
|
||||
}
|
||||
|
||||
// PHP8+: PDO::lastInsertId(?string $name = null): string|false
|
||||
#[\ReturnTypeWillChange]
|
||||
public function lastInsertId($name = null) {
|
||||
if ($name != null) {
|
||||
$name = $this->preSql($name);
|
||||
@@ -35,16 +37,22 @@ abstract class Minz_Pdo extends PDO {
|
||||
return parent::lastInsertId($name);
|
||||
}
|
||||
|
||||
// PHP8+: PDO::prepare(string $query, array $options = []): PDOStatement|false
|
||||
#[\ReturnTypeWillChange]
|
||||
public function prepare($statement, $driver_options = array()) {
|
||||
$statement = $this->preSql($statement);
|
||||
return parent::prepare($statement, $driver_options);
|
||||
}
|
||||
|
||||
// PHP8+: PDO::exec(string $statement): int|false
|
||||
#[\ReturnTypeWillChange]
|
||||
public function exec($statement) {
|
||||
$statement = $this->preSql($statement);
|
||||
return parent::exec($statement);
|
||||
}
|
||||
|
||||
// PHP8+: PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false
|
||||
#[\ReturnTypeWillChange]
|
||||
public function query($query, $fetch_mode = null, ...$fetch_mode_args) {
|
||||
$query = $this->preSql($query);
|
||||
return $fetch_mode ? parent::query($query, $fetch_mode, ...$fetch_mode_args) : parent::query($query);
|
||||
|
||||
@@ -415,7 +415,7 @@ class Minz_Request {
|
||||
* @return string
|
||||
*/
|
||||
private static function extractContentType() {
|
||||
return strtolower(trim(static::getHeader('CONTENT_TYPE')));
|
||||
return strtolower(trim(static::getHeader('CONTENT_TYPE', '')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -454,7 +454,7 @@ class Minz_Request {
|
||||
* @return array
|
||||
*/
|
||||
public static function getPreferredLanguages() {
|
||||
if (preg_match_all('/(^|,)\s*(?P<lang>[^;,]+)/', static::getHeader('HTTP_ACCEPT_LANGUAGE'), $matches)) {
|
||||
if (preg_match_all('/(^|,)\s*(?P<lang>[^;,]+)/', static::getHeader('HTTP_ACCEPT_LANGUAGE', ''), $matches)) {
|
||||
return $matches['lang'];
|
||||
}
|
||||
return array('en');
|
||||
|
||||
@@ -165,7 +165,7 @@ function html_only_entity_decode($text) {
|
||||
get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES, 'UTF-8') //Preserve XML entities
|
||||
));
|
||||
}
|
||||
return strtr($text, $htmlEntitiesOnly);
|
||||
return $text == '' ? '' : strtr($text, $htmlEntitiesOnly);
|
||||
}
|
||||
|
||||
function customSimplePie($attributes = array()) {
|
||||
|
||||
Reference in New Issue
Block a user