mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-17 18:30:55 +00:00
Pass correct type to constructor
Although there was no docblock on CaptchaAuthenticationRequest::__construct, the method is supposed to get a string and an array, as that's how the class members are documented and used. Trying to access offsets of null resulted in PHP notices on PHP 7.4, as seen in the experimental job for various repos. Bug: T239726 Change-Id: Idd073ebf3d560543ec225479de060e3c198847eb
This commit is contained in:
parent
a9c698f83c
commit
7297235b2a
|
@ -8,7 +8,7 @@ use MediaWiki\Auth\AuthenticationRequest;
|
|||
*/
|
||||
class ReCaptchaNoCaptchaAuthenticationRequest extends CaptchaAuthenticationRequest {
|
||||
public function __construct() {
|
||||
parent::__construct( null, null );
|
||||
parent::__construct( '', [] );
|
||||
}
|
||||
|
||||
public function loadFromSubmission( array $data ) {
|
||||
|
|
|
@ -192,7 +192,7 @@ class SimpleCaptcha {
|
|||
* @return string Description of the captcha. Format is not specified; could be text, HTML, URL...
|
||||
*/
|
||||
public function getCaptchaInfo( $captchaData, $id ) {
|
||||
return $captchaData['question'] . ' =';
|
||||
return array_key_exists( 'question', $captchaData ) ? ( $captchaData['question'] . ' =' ) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,10 @@ class CaptchaAuthenticationRequest extends AuthenticationRequest {
|
|||
/** @var string Captcha solution submitted by the user. */
|
||||
public $captchaWord;
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct( $id, $data ) {
|
||||
$this->captchaId = $id;
|
||||
$this->captchaData = $data;
|
||||
|
@ -83,7 +87,7 @@ class CaptchaAuthenticationRequest extends AuthenticationRequest {
|
|||
}
|
||||
|
||||
public static function __set_state( $data ) {
|
||||
$ret = new static( null, null );
|
||||
$ret = new static( '', [] );
|
||||
foreach ( $data as $k => $v ) {
|
||||
$ret->$k = $v;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue