Topic on Extension talk:TinyMCE

Depricated Hook After Upgrading to MediaWiki 1.37.1

5
Summary by DuncanCrane

Problem caused by php warning errors not being handled correctly in the set up of the wiki. See detail for how to avoid this.

74.136.16.180 (talkcontribs)

Hello, I'm not sure which version I was using before, but I just upgraded to 1.37.1 and upgraded the TinyMCE extension. When I try to edit a page with TinyMCE I get


Deprecated</b>: Use of EditPageBeforeEditToolbar hook (used in TinyMCEHooks::removeDefaultToolbar) was deprecated in MediaWiki 1.36. [Called from MediaWiki\HookContainer\HookContainer::run in /directory/public/includes/HookContainer/HookContainer.php at line 137] in <b>/directory/public/includes/debug/MWDebug.php</b> on line <b>375


Any suggestions?

DuncanCrane (talkcontribs)

Hi, would you let me know the version of the TinyMCE extension you are using? The maintenance policy for the TinyMCE extension is 'master' so the master branch on Gerrit is the one to use. If you check the version number for TinyMCE on the 'version' special page on your wiki, what does it say? Many thanks Duncan

74.136.16.180 (talkcontribs)

Hi, I went ahead and did


git clone "h...://gerrit.wikimedia.org/r/mediawiki/extensions/TinyMCE" (modified this because it was saying linkspam warning on mediawiki.org submission box)


and my version shows as 1.1.2 (f9abe09) 08:38, 30 December 2021.


I am still getting the same error. Thank you for your help.

Activede (talkcontribs)

Hello, I've got the same problem. After moving to a stronger server – with probably some different software running – TinyMCE stopped working. The Toolbar doesn't show up at all and if you activate PHP-Errors I do get the same error.

Update: Also occurs using mediawiki 1.37.0 Update: Apparently the issue is already solved when php errors are deactivated. Clear browser cache afterwards and that worked for me.

DuncanCrane (talkcontribs)

Thank you both for the responses. The deprecation message is, I believe, a warning message. Although the code is deprecated, it hasn't been removed from the Mediawiki core (https://www.mediawiki.org/wiki/Manual:Hooks/EditPageBeforeEditToolbar). The reason it still exists in the TinyMCE extension is to maintain backward compatibility with Mediawiki version 1.35, which is the current long term stable version, and still widely in use. It appears that the problem is being caused by the Mediawiki system reporting the warning when PHP errors are activated, rather than the the existence of the deprecated code itself in the TinyMCE extension.

It seems that, when Mediawiki outputs an error message, the page output is no longer in standards mode (https://www.tiny.cloud/blog/tinymce-requires-standards-mode/). This is potentially a bug in Mediawiki as, without error reporting, Mediawiki does output pages in standards mode, as Activede points out. This might be considered as a bug in Mediawiki not trapping and handling php warning error messages in a way that allows execution to proceed, although there are ways to debug mediawiki that might allow this (https://www.mediawiki.org/wiki/Manual:How_to_debug) by using a log file for error messages. Alternatively you could use the following in local settings, which means only fatal php error will be output to the browser page (note the +ve '1' not -ve as in the Mediawiki documentation:

error_reporting( 1 )

I hope this works for you but, if not, please let me know.