Skip to content

SLOP-398: guard onPageViewUpdates against ReviewHandler::setup() returning false - #4

Open
tosfos wants to merge 1 commit into
masterfrom
SLOP-398-guard-setup-false
Open

SLOP-398: guard onPageViewUpdates against ReviewHandler::setup() returning false#4
tosfos wants to merge 1 commit into
masterfrom
SLOP-398-guard-setup-false

Conversation

@tosfos

@tosfos tosfos commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Hooks::onPageViewUpdates calls ReviewHandler::setup(...), which explicitly returns false for unwatchable titles, then invokes $reviewHandler::pageIsBeingReviewed(). On false this is a static call on a bool → Error: Class name must be a valid object or a string. Since PageViewUpdates fires on every page view, any visit to a page in an unwatchable namespace fatals the deferred update.

The fix guards with instanceof ReviewHandler before calling the method (also converting the odd Class::method() syntax to an instance call).

Verification

  • php -l clean on php:7.4-cli and php:8.2-cli.
  • Harness on both 7.4 and 8.2 with stubbed setup(): OLD fatals for both watchable and unwatchable titles when setup returns false; NEW never fatals — returns false for unwatchable (no template injected) and proceeds normally for watchable pages.

Note: the underlying $title->isWatchable() removal inside setup() is tracked separately in SLOP-375; once that lands on MW 1.39, setup() will again return objects for watchable pages and this guard simply makes the false path safe.

Closes SLOP-398.

ReviewHandler::setup() returns false for unwatchable titles, and the
following static-style call $reviewHandler::pageIsBeingReviewed()
fatals with "Class name must be a valid object or a string" on every
page view in an unwatchable namespace. Check instanceof before use.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 63d6de7c-9f94-4773-b6b6-0dd24452748a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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