diff options
| author | 2022-09-19 11:50:46 +0200 | |
|---|---|---|
| committer | 2022-09-19 11:50:46 +0200 | |
| commit | 6813e16e95c631084029cc84f786acd87495c063 (patch) | |
| tree | 583fab4f63f02e7e27f00e898d61b471c950b993 /lib/lib_rss.php | |
| parent | 6bed64f6f360e1480bf5efc0d52d255b85791242 (diff) | |
fix: Fix preg_match in enforceHttpEncoding (#4623)
`preg_match` can return `1`, `0` or `false`. In this last case,
`enforceHttpEncoding` was trying to access `$matches[1]`, even if the regex wasn't matching.
Diffstat (limited to 'lib/lib_rss.php')
| -rw-r--r-- | lib/lib_rss.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 743aa7840..7a7a28225 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -351,7 +351,7 @@ function cleanCache(int $hours = 720) { * @return string an HTML string with XML encoding information for DOMDocument::loadHTML() */ function enforceHttpEncoding(string $html, string $contentType = ''): string { - $httpCharset = preg_match('/\bcharset=([0-9a-z_-]{2,12})$/i', $contentType, $matches) === false ? '' : $matches[1]; + $httpCharset = preg_match('/\bcharset=([0-9a-z_-]{2,12})$/i', $contentType, $matches) === 1 ? $matches[1] : ''; if ($httpCharset == '') { // No charset defined by HTTP, do nothing return $html; |
