Hook ReCaptcha::confirmEdit failed to return a value
Today, editing (and saving) a MediaWiki article barfed with:
Detected bug in an extension! Hook ReCaptcha::confirmEdit failed to return a value; should return true to continue hook processing or false to abort. Backtrace: #0 ../includes/EditPage.php(802): wfRunHooks('EditFilter', Array) #1 ../includes/EditPage.php(2552): EditPage->internalAttemptSave(false, false) #2 ../includes/EditPage.php(389): EditPage->attemptSave() #3 ../includes/EditPage.php(271): EditPage->edit() #4 ../includes/Wiki.php(553): EditPage->submit() #5 ../includes/Wiki.php(70): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest)) #6 ../index.php(117): MediaWiki->performRequestForTitle(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest)) #7 {main}Apparently, this has been caused by the recent upgrade to Debian/Squeeze, which comes with php-5.3.3. The fix is to apply the following patch to the reCAPTCHA extension:
--- mediawiki/ConfirmEdit.php.orig 2011-02-13 07:55:38.366172048 +0100 +++ mediawiki/ConfirmEdit.php 2011-02-13 07:59:47.115119111 +0100 @@ -483,7 +483,7 @@ class SimpleCaptcha { * @param string $section * @param bool true to continue saving, false to abort and show a captcha form */ - function confirmEdit( &$editPage, $newtext, $section ) { + function confirmEdit( $editPage, $newtext, $section ) { if( $this->shouldCheck( $editPage, $newtext, $section ) ) { if( $this->passCaptcha() ) { return true; --- mediawiki/ReCaptcha.php.orig 2011-02-13 07:57:27.700624763 +0100 +++ mediawiki/ReCaptcha.php 2011-02-13 08:05:47.903120256 +0100 @@ -97,7 +97,7 @@ class ReCaptcha extends SimpleCaptcha { * Called on all edit page saves. (EditFilter events) * @return boolean - true if page save should continue, false if should display Captcha widget. */ - function confirmEdit( &$editPage, $newtext, $section ) { + function confirmEdit( $editPage, $newtext, $section ) { if( $this->shouldCheck( $editPage, $newtext, $section ) ) { if (!isset($_POST['recaptcha_response_field'])) {