N°8681 - PHP 8.1: Fix deprecated notice for null value passed to preg_match_all()

This commit is contained in:
Molkobain
2026-02-15 21:09:54 +01:00
parent 4f878536a8
commit d6f732e719
2 changed files with 6 additions and 0 deletions

View File

@@ -4259,6 +4259,9 @@ class AttributeText extends AttributeString
public static function RenderWikiHtml($sText, $bWikiOnly = false) public static function RenderWikiHtml($sText, $bWikiOnly = false)
{ {
// N°8681 - Ensure to have a string value
$sText = $sText ?? '';
if (!$bWikiOnly) { if (!$bWikiOnly) {
$sPattern = '/'.str_replace('/', '\/', utils::GetConfig()->Get('url_validation_pattern')).'/i'; $sPattern = '/'.str_replace('/', '\/', utils::GetConfig()->Get('url_validation_pattern')).'/i';
if (preg_match_all( if (preg_match_all(

View File

@@ -266,6 +266,9 @@ class InlineImage extends DBObject
*/ */
public static function FixUrls($sHtml) public static function FixUrls($sHtml)
{ {
// N°8681 - Ensure to have a string value
$sHtml = $sHtml ?? '';
$aNeedles = []; $aNeedles = [];
$aReplacements = []; $aReplacements = [];
// Find img tags with an attribute data-img-id // Find img tags with an attribute data-img-id