Piwigo/ExtendedDescription

Compatibility with php 8.1

Closed this issue · 1 comments

After switching to php 8.1 I found two warnings.

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /.../piwigo13/plugins/ExtendedDescription/include/events.inc.php on line 102

Current code:

102: return preg_replace($patterns, $replacements, $desc');

Fix:

102: return preg_replace($patterns, $replacements, $desc ?: '');

Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /.../piwigo13/plugins/ExtendedDescription/include/events.inc.php on line 120

Current code:

123: and preg_match('#\[redirect (.*?)\]#i', $desc, $m1)

Fix:

123: and preg_match('#\[redirect (.*?)\]#i', $desc ?: '', $m1)

At least this seems to fix it for me :-)

was fixed by f314292