aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-05-11 13:02:04 +0200
committerGravatar GitHub <noreply@github.com> 2023-05-11 13:02:04 +0200
commit6e2f2f1c1e98ecd86aa89c6547beb742d7385d18 (patch)
tree7ba9f5aebb01d12045b9067a86b5060ba13dca18 /lib/lib_rss.php
parentfe7d9bbcd68660a59b813346c236b61b25a51c80 (diff)
A few additional PHPStan rules (#5388)
A subset of https://github.com/phpstan/phpstan-strict-rules
Diffstat (limited to 'lib/lib_rss.php')
-rw-r--r--lib/lib_rss.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 9c9d44a4c..1ae99e6a1 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -224,7 +224,7 @@ function html_only_entity_decode(?string $text): string {
function sensitive_log($log) {
if (is_array($log)) {
foreach ($log as $k => $v) {
- if (in_array($k, ['api_key', 'Passwd', 'T'])) {
+ if (in_array($k, ['api_key', 'Passwd', 'T'], true)) {
$log[$k] = '██';
} elseif (is_array($v) || is_string($v)) {
$log[$k] = sensitive_log($v);
@@ -331,7 +331,7 @@ function customSimplePie(array $attributes = array()): SimplePie {
/** @param string $data */
function sanitizeHTML(string $data, string $base = '', ?int $maxLength = null): string {
- if (!is_string($data) || ($maxLength !== null && $maxLength <= 0)) {
+ if ($data === '' || ($maxLength !== null && $maxLength <= 0)) {
return '';
}
if ($maxLength !== null) {
@@ -851,8 +851,9 @@ function errorMessageInfo(string $errorTitle, string $error = ''): string {
$message = '';
$details = '';
- // Prevent empty tags by checking if error isn not empty first
- if ($error) {
+ $error = trim($error);
+ // Prevent empty tags by checking if error is not empty first
+ if ($error !== '') {
$error = htmlspecialchars($error, ENT_NOQUOTES, 'UTF-8') . "\n";
// First line is the main message, other lines are the details