Topic on Extension talk:Favorites

"an error occurred ..." MW 1.35.4, 1.35.5

2003:C2:3F1C:100:A11D:7FB3:D263:8A51 (talkcontribs)

MW 1.35.4, PHP 7.4.24


when clicking "+Favorite", a small message box appears "An error occurred when changing the favorites setting for ..."

By activating the debug options in LocalSettings, I find the following log entry in the Apache error log:

AH01071: Got error 'PHP message: PHP Deprecated:  Use of InternalParseBeforeSanitize hook (used in VariablesHooks::onInternalParseBeforeSanitize) was deprecated in MediaWiki 1.35. [Called from MediaWiki\\HookContainer\\HookContainer::run in [........]/mediawiki/includes/HookContainer/HookContainer.php at line 132] in [........]/mediawiki/includes/debug/MWDebug.php on line 430', referer: [ name.....]

Anyone else having the same problem? What can I do to find out more ?

Ciencia Al Poder (talkcontribs)
2003:C2:3F1C:100:A11D:7FB3:D263:8A51 (talkcontribs)

... not really. The network tab shows an answer of "200" on a post request, and the detailed view tells me:

{"error":{"code":"internal_api_error_Error","info":"[ad70de264e45ab8a9f92a964] Caught exception of type Error","errorclass":"Error"}}

so it seems the extension itself handles an exception. All well-known debug options in LocalSettings are set, the Mediawiki log file is empty.

2003:C2:3F1C:100:A11D:7FB3:D263:8A51 (talkcontribs)

In PHP, deprecation warnings are off:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

but this seemingly does not work as Apache reports the warnings as "AH01071 Got error".

Ciencia Al Poder (talkcontribs)
2003:C2:3F1C:100:3946:3285:873C:3F66 (talkcontribs)

$wgShowExceptionDetails = true and I thought it had been so before ... after some try&error, I still can't find no stacktrace nowhere, neither in the Mediawiki log nor in the Apache logfile. But eventually the browser network viewer tab tells me a little bit more:


"[792bf7348e100b98b656ca9a] Exception caught: Call to undefined method ApiFavorite::dieUsageMsg()"

"Error at [.......]/extensions/Favorites/api/ApiFavorite.php(41)\n

#0 [.......]/includes/api/ApiMain.php(1593): ApiFavorite->execute()\n

#1 [.......]/includes/api/ApiMain.php(529): ApiMain->executeAction()\n

#2 [.......]/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()\n

#3 [.......]/api.php(90): ApiMain->execute()\n

#4 [.......]/api.php(45): wfApiMain()\n

#5 {main}"

Obviously part of our installation is outdated, the extension or some of the core functions. Mediawiki = 1.35.4, PHP = 7.4.3, Favorites = 1.1.3 (downloaded few days ago via ExtensionDistributor). Do I have the wrong extension version?

2003:C2:3F1C:100:3946:3285:873C:3F66 (talkcontribs)

ApiFavorites line 29-42:

               if ( $params['unfavorite'] ) {

                       $res['unfavorited'] = '';

                       $res['message'] = $this->msg( 'removedfavoritetext', $title->getPrefixedText() )->title( $title )->parseAsBlock();

                       $success = false;

                       //$success = UnfavoriteAction::doUnfavorite( $title, $user );

               } else {

                       $res['favorited'] = '';

                       $res['message'] = $this->msg( 'addedfavoritetext', $title->getPrefixedText() )->title( $title )->parseAsBlock();

                       $success = false;

                       //$success = FavAction::doFavorite( $title, $user );


               if ( !$success ) {

                       $this->dieUsageMsg( 'hookaborted' );


$success is always st to false!?

Ciencia Al Poder (talkcontribs)
2003:C2:3F1C:100:9464:F8C6:FD5E:F88F (talkcontribs)

Sadly I see. Repairing the code is far beyond my skill. I hope someone someday will take the necessary steps.

Many thanks for your support.

Gota de agua (talkcontribs)

i test the extension and i thought it was the problem due to the use of the Titlemovecomplete hook that was removed in mediawiki 1.37, so I left a warning on the extension page but I see that it is something else, if someone could make a patch in gerrit I would be grateful because the extension is still interesting

Rdrg109 (talkcontribs)

I'm having the same issue using Mediawiki 1.38.4-1, mariadb 10.9.3-3, PHP 8.1.12-2.

Reply to ""an error occurred ..." MW 1.35.4, 1.35.5"