The module does not work on Drupal 9 but according to the mercury_editor.info.yml it is stated wrongly as compatible

Created on 19 March 2024, 8 months ago
Updated 28 March 2024, 8 months ago

Problem/Motivation

I tried the module on one of our older sites which was not updated yet to the latest Drupal, and runs on Drupal 9.5. This is what you get after installing the module:

The website encountered an unexpected error. Please try again later.
Error: Undefined constant Drupal\mercury_editor\StackMiddleware\AjaxPageState::MAIN_REQUEST in Drupal\mercury_editor\StackMiddleware\AjaxPageState->handle() (line 30 of modules/contrib/mercury_editor/src/StackMiddleware/AjaxPageState.php).
Drupal\mercury_editor\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

In Drupal 9, Symfony 4 was used (instead of Symfony 6 like in Drupal 10) and instead of MAIN_REQUEST, it is called MASTER_REQUEST.

Error: Call to undefined method Drupal\Component\Utility\UrlHelper::uncompressQueryParameter() in Drupal\mercury_editor\StackMiddleware\AjaxPageState->parseAjaxPageState() (line 53 of /app/web/modules/contrib/mercury_editor/src/StackMiddleware/AjaxPageState.php)
#0 /app/web/modules/contrib/mercury_editor/src/StackMiddleware/AjaxPageState.php(32): Drupal\mercury_editor\StackMiddleware\AjaxPageState->parseAjaxPageState(Array)
#1 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\mercury_editor\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#2 /app/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#3 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#4 {main}

In Drupal 9, there is no such method, it was added only in Drupal 10 core.

So need to decide:
- if we retain compatibility, then code needs to be extended with current Drupal version check and calling the right method and constants that are actually available.
- remove ^9 from the mercury_editor.info.yml, so no Drupal 9 compatibility anymore (quicker fix).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024