Page MenuHomePhabricator

Contents of MediaWiki:Captchahelp-text are duplicated on Special:Captcha/help
Open, LowPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What should have happened instead?:

Text should not be duplicated.

Event Timeline

Restricted Application changed the subtype of this task from "Bug Report" to "Production Error". · View Herald TranscriptNov 23 2025, 4:57 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Pppery changed the subtype of this task from "Production Error" to "Bug Report".
Reedy triaged this task as Low priority.EditedNov 23 2025, 11:13 PM
Reedy subscribed.

This could be merged into T399042: Make Special:Captcha display relevant information for all captchas enabled on a wiki because it's still open.

No specific override has been set for FancyCaptcha (but one has been for hCaptcha), so rECOE1c5572e5d3e3: SpecialCaptcha: Display help for all captchas enabled on a wiki is working as intended.

	/**
	 * Show a page explaining what this wacky thing is.
	 *
	 * @param OutputPage $out The OutputPage to add the help text to
	 */
	public function showHelp( OutputPage $out ) {
		$msg = wfMessage( static::$messagePrefix . 'help-text' );
		if ( $msg->isDisabled() ) {
			// Fallback to simplecaptchahelp-text
			$msg = wfMessage( self::$messagePrefix . 'help-text' );
		}

		$out->addWikiMsg( $msg );
	}

and the caller

public function execute( $par ) {
		$this->setHeaders();

		// TODO: This should probably be passing an action otherwise it's going to just fallback to $wgCaptchaClass
		$instance = Hooks::getInstance();

		if ( $par === 'image' && method_exists( $instance, 'showImage' ) ) {
			// @todo: Do this in a more OOP way
			/** @phan-suppress-next-line PhanUndeclaredMethod */
			$instance->showImage( $this->getContext() );
			return;
		}

		$out = $this->getOutput();

		$out->setPageTitleMsg( $out->msg( 'captchahelp-title' ) );
		$out->addWikiMsg( 'captchahelp-text' );

		if ( CaptchaStore::get()->cookiesNeeded() ) {
			$out->addWikiMsg( 'captchahelp-cookies-needed' );
		}

		foreach ( Hooks::getActiveCaptchas() as $captcha ) {
			/** @var SimpleCaptcha $captcha */

			$out->addHtml(
				Html::element(
					'h2',
					[],
					$captcha->getName()
				)
			);

			$captcha->showHelp( $out );
		}
	}