Topic on Project:Support desk

Fatal exception of type "Error" on preview

4
Matt-at-Penman (talkcontribs)

Hello, we've just migrated the data from an old version of Mediawiki / an unsupported OS platform to MediaWIki 1.32.0 / running on PHP 7.0 on Ubuntu 16.04. The migrate was done by building a new platform, copying the SQL data (and image files) from the old system and making minimum necessary changes to the new plarform's configuration file. The data import worked fine, migration script (php /usr/share/mediawiki/maintenance/update.php) completed without error, wiki 'mostly' works. The only error is as in the subject when attempting to preview a change (or actually, preview itself, you don't need to change anything, just ask for a preview). These fail with message of the form:

[04f796e3b179a4cdf7946122] 2019-05-20 15:11:35: Fatal exception of type "Error"

with a different number in the square brackets and time stamp.

The web server (nginx 1.16.0) records error messages of the form below, one error message for each attempt to preview:

2019/05/20 15:24:06 [error] 18426#18426: *8136 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: CKeditorEditPage::$isCssJsSubpage in /usr/share/mediawiki/extensions/WYSIWYG-src/WYSIWYG/CKeditorEditPage.body.php on line 35" while reading response header from upstream, client: [redacted], server: [redacted].com, request: "POST /index.php?title=Category:Sysadmin&action=submit HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "[redacted].com", referrer: "https://[redacted].com/index.php?title=Category:Sysadmin&action=edit"

where I've removed the external address of the site and the server name and replaced then with [redacted] instead.

Saving changes *without* preview works fine, the saved pages are rendered correctly. WIth preview it consistently fails with the error message.

Malyacko (talkcontribs)
Matt-at-Penman (talkcontribs)

Thank you for that, yes, does look like the issue is in WYSIWYG. Below is what is output on the GUI once the debug and stack trace are turned on and I try to preview a page.


[5f734fc7e51814e99dbbd919] /index.php?title=Category:Sysadmin&action=submit Error from line 36 of /usr/share/mediawiki/extensions/WYSIWYG-src/WYSIWYG/CKeditorEditPage.body.php: Call to undefined function wfRunHooks()

Backtrace:

#0 /usr/share/mediawiki/includes/EditPage.php(2749): CKeditorEditPage->getPreviewText()

#1 /usr/share/mediawiki/includes/EditPage.php(702): EditPage->showEditForm()

#2 /usr/share/mediawiki/extensions/WYSIWYG-src/WYSIWYG/CKeditor.body.php(303): EditPage->edit()

#3 /usr/share/mediawiki/includes/Hooks.php(174): CKeditor_MediaWiki->onCustomEditor(CategoryPage, User)

#4 /usr/share/mediawiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)

#5 /usr/share/mediawiki/includes/actions/EditAction.php(57): Hooks::run(string, array)

#6 /usr/share/mediawiki/includes/actions/SubmitAction.php(38): EditAction->show()

#7 /usr/share/mediawiki/includes/MediaWiki.php(501): SubmitAction->show()

#8 /usr/share/mediawiki/includes/MediaWiki.php(294): MediaWiki->performAction(CategoryPage, Title)

#9 /usr/share/mediawiki/includes/MediaWiki.php(860): MediaWiki->performRequest()

#10 /usr/share/mediawiki/includes/MediaWiki.php(517): MediaWiki->main()

#11 /usr/share/mediawiki/index.php(42): MediaWiki->run()

#12 {main}

Matt-at-Penman (talkcontribs)

Interesting, it looks like wfRunHooks is a deprecated function as of the version this system was built with but is still being called by WYSIWYG... the file identified in the stack trace above at line 36 has

"wfRunHooks( 'EditPageBeforePreviewText', array( &$this, $this->previewOnOpen() ) );

so it appears not to be compatible with the latest MediaWiki version. It's also got at least one other occurrence of wfRunHooks in it.


And testing... it appears that by replacing wfRunHooks at lines 36 and 38 in the referenced file by Hooks::run the issue is resolved... previews work again. Probably would benefit from being fitted into WYSIWYG code...

Reply to "Fatal exception of type "Error" on preview"