Page MenuHomePhabricator

Preview fails when $wgRawHtml is activated
Closed, ResolvedPublic


When $wgRawHtml is true, the preview in forms fails with the MediaWiki error message session_fail_preview_html (expanded below).

It should be still a bit investigated but the edit token (classically wpEditToken) is probably not provided, perhaps in an internal FauxRequest - I see there are such things in PF_AutoeditAPI.php - but there is such token provided in the API POST request action=pfautoedit, so possibly some link is missing somewhere to pass this token internally.

I’m not sure if it is linked to T189812, the patch provided there did not improved the effects of the current bug.

Sorry! We could not process your edit due to a loss of session data.
Because {{SITENAME}} has raw HTML enabled, the preview is hidden as a precaution against JavaScript attacks.
If this is a legitimate edit attempt, please try again. If it still does not work, try [[Special:UserLogout|logging out]] and logging back in, and check that your browser allows cookies from this site.


  • PageForms: 4.9.3 - 02485334b54
  • MediaWiki: 1.34.1 - 65e25dd3e98

Event Timeline

Yaron_Koren claimed this task.
Yaron_Koren added a subscriber: Yaron_Koren.

I just tried this, and can't duplicate the problem - I'm guessing it was fixed in MediaWiki a while ago.

For the record, I found the solution and it is unrelated to PageForms.

It occurs systematically when the EditPage stays open for more than 1h and when $wgRawHtml is true. This delay corresponds to $wgObjectCacheSessionExpiry (default 1h, it is the delay the server keeps the session details before purging it), so it can be solved by increasing this delay.

Very interesting - thats good to know.