Skip to content

SLOP-46: Fix null dereference and null string use in RetainedArticles#3

Open
tosfos wants to merge 1 commit intomasterfrom
SLOP-46-fix-null-retainedarticles
Open

SLOP-46: Fix null dereference and null string use in RetainedArticles#3
tosfos wants to merge 1 commit intomasterfrom
SLOP-46-fix-null-retainedarticles

Conversation

@tosfos
Copy link
Contributor

@tosfos tosfos commented Feb 13, 2026

Fixes fatal when WikiPageFactory returns null and PHP 8 TypeError when mBodytext is null.

Jira: SLOP-46

Changes:

  1. Tools.php createRedirect: getWikiPageFactory()->newFromTitle() can return null (e.g. when a hook returns false). Check for null and throw MWException so the caller (Hooks::onPageDeleteComplete) can catch and log instead of fataling.
  2. OverwrittenDeleteAction.php: $outputPage->mBodytext can be null. Use ?? '' when reading it for getOffsetOfSubmitButtonFieldLayout and showForm so preg_match_all and substr_replace do not receive null (PHP 8 TypeError/deprecation).

- Tools::createRedirect: check newFromTitle() result for null and throw MWException to avoid fatal
- OverwrittenDeleteAction: use mBodytext ?? '' to avoid passing null to preg_match_all/substr_replace (PHP 8)

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant