Fix dynamic property usage

Status now provides declared $statusData property for holding
arbitrary data that can be used instead.

Bug: T326479
Depends-On: Ibe3f1f8b81bcfcb18551d3ca4cda464e4bdbcbce
Change-Id: I1342a8a8ca64b4040ed2b2d101d4574aedd888af
(cherry picked from commit 0ae3137ead)
This commit is contained in:
Ammarpad 2023-11-28 13:50:35 +01:00 committed by Reedy
parent a07a4fdf94
commit 31b5986341

View file

@ -913,14 +913,14 @@ class SimpleCaptcha {
$page = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $title );
if ( !$this->doConfirmEdit( $page, $content, '', $context, $user ) ) {
$status->value = EditPage::AS_HOOK_ERROR_EXPECTED;
$status->apiHookResult = [];
$status->statusData = [];
// give an error message for the user to know, what goes wrong here.
// this can't be done for addurl trigger, because this requires one "free" save
// for the user, which we don't know, when he did it.
if ( $this->action === 'edit' ) {
$status->fatal( 'captcha-edit-fail' );
}
$this->addCaptchaAPI( $status->apiHookResult );
$this->addCaptchaAPI( $status->statusData );
$key = CacheKeyHelper::getKeyForPage( $page );
$this->activatedCaptchas[$key] = true;
return false;