N°8681 - PHP 8.1: Fix deprecated notice for null value passed to preg_match_all()#803
Merged
Molkobain merged 3 commits intosupport/3.2from Feb 16, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes PHP 8.1 deprecation notices caused by passing null as the $subject argument to preg_match_all() by hardening wiki/HTML rendering paths to coerce null inputs to empty strings.
Changes:
- Coerce
nullto''inAttributeText::RenderWikiHtml()before running regex processing. - Coerce
nullto''inInlineImage::FixUrls()before parsing/replacing<img ... data-img-id="...">tags.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| core/inlineimage.class.inc.php | Hardens InlineImage::FixUrls() against null input before calling preg_match_all(). |
| core/attributedef.class.inc.php | Hardens AttributeText::RenderWikiHtml() against null input before calling preg_match_all(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bdalsass
approved these changes
Feb 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base information
Symptom (bug)
Reproduction procedure (bug)
I could not find how to reproduce locally what we witnessed on the customer's instance...
Cause (bug)
Shallow cause:
In
AttributeText::GetAsHTML(),$sValueseems to benullin some cases, which when passed toAttributeText::RenderWikiHtml()andInlineImage::FixUrls()will be passed topreg_match_all()in the$subjectparameter that as of PHP 8.1 only supportsstringvalues.Root cause:
How we happen to pass
nullinAttributeText::GetAsHTML()remains a mystery for now.Proposed solution (bug and enhancement)
Even though we can't find where the
nullcomes from, we can harden theAttributeText::RenderWikiHtml()andInlineImage::FixUrls()methods so they convertnullvalues tostring. Minimizing the risk of regression while fixing the issue.During the merge into 3.3 branch, I suggest to also change the
AttributeText::RenderWikiHtml()andInlineImage::FixUrls()methods prototype to type the relevant parameter tostring|null.Checklist before requesting a review
Checklist of things to do before PR is ready to merge