Subformstate incorrect interface error

Created on 17 December 2023, about 1 year ago

Problem/Motivation

Fatal error: Class Drupal\markdown\BcSupport\SubformState contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Form\FormStateInterface::setIgnoreDestination, Drupal\Core\Form\FormStateInterface::getIgnoreDestination) in /web/modules/patched/markdown/src/BcSupport/SubformState.php on line 16

Steps to reproduce

Installed markdown on a D10 site with php 8.2. Tried to edit the content formats

/admin/config/content/formats/manage/basic_html?destination=/admin/config/content/formats

Proposed resolution

Implement the suggested deprecation described in Subformstate.

Remaining tasks

๐Ÿ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia interlated

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

Merge Requests

Comments & Activities

  • Issue created by @interlated
  • Merge request !293409277 use drupal core SubformState โ†’ (Open) created by interlated
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    Build Successful
  • ๐Ÿ‡ฌ๐Ÿ‡ทGreece walkero

    I have the specific issue on my site, running on PHP 8.1

  • Status changed to RTBC 12 months ago
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 12 months ago
    Build Successful
  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan tyler36 Osaka

    patch #4 worked for me.

    Marking as RTBC
    Bumping priority to "major" because it breaks site functionality (prevents access to content formats)

    ## TEST

    1. Install and enable Markdown addon

    composer require 'drupal/markdown:^3.0'
    drush en markdown
    

    2. Visit "/admin/config/content/formats/manage/basic_html"
    - Error displays "Class Drupal\markdown\BcSupport\SubformState contains 2..."
    3. Apply #4
    4. Page displays correctly

    Drupal-core: 10.2
    Markdown: 3.0.1

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan tyler36 Osaka

    Came across https://www.drupal.org/project/markdown/issues/3409277 ๐Ÿ› Subformstate incorrect interface error Active which attempts to patch issue, but thedoesn't work.
    Not sure if maintainer want to give credit for any work there.

    I'm going to close 3409277 in favor of this because it's working.

  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan tyler36 Osaka

    Back to NW, noticed the following error appearing under the filter settings:

    Drupal\markdown\Form\ParserConfigurationForm::buildParser(): Argument #2 ($form_state) must be of type Drupal\markdown\Form\SubformStateInterface, Drupal\Core\Form\SubformState given, called in /var/www/html/web/modules/contrib/markdown/src/Form/ParserConfigurationForm.php on line 239
    
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada ambient.impact Toronto

    Ambient.Impact โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 12 months ago
    Build Successful
  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada ambient.impact Toronto

    This seems to be partly caused by the deprecated backwards compat \Drupal\markdown\BcSupport\SubformState and its interface, both of which seem to have been intended to be removed in 3.0.0 but probably got overlooked. Anywho, I think I fixed the remaining errors and I can access the filter form again.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada ambient.impact Toronto

    Please use issue forks going forward. If you need a patch file, you can download those from GitLab.

  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States olarin

    Tried both the merge request and the patch in #4 (not at the same time of course). In either case, while I could successfully edit the text format again, when looking at the Markdown filter settings in the text format, the following error was displayed:

    Error message
    Drupal\markdown\Form\ParserConfigurationForm::buildParser(): Argument #2 ($form_state) must be of type Drupal\markdown\Form\SubformStateInterface, Drupal\Core\Form\SubformState given, called in /var/www/html/webroot/modules/markdown/src/Form/ParserConfigurationForm.php on line 239

    Furthermore, if I save the text format (even without making changes), then it seems to break formatting entirely, i.e. a text field using Markdown is displayed without _any_ formatting, as in no HTML tags at all, not even line breaks or paragraphs. (Fortunately I tested this on a dev copy of a site and not a live site.) There are other filters at play on the site in question, but I tried turning all the rest of them off and confirmed that Markdown specifically is the one causing the formatting to be stripped (whereas if I turn Markdown off the text at least gets paragraphs and line breaks again, and the other filters can work as expected).

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 12 months ago
    Build Successful
  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada ambient.impact Toronto

    @Olarin You're totally right. I caught that exact problem late last night but didn't get around to pushing my changes until now. It looks like it was caused by the original commit which replaced Markdown's SubformState with core's, but that didn't fix the root cause and conflicted with my commits. I reverted the original commit and it seems to have fixed it for me, so would like to know if it fixes it for you as well. You may have to import config in your dev environment again to fix it, because it's a nasty bug that would have nuked the active config or at least did for me.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States olarin

    Yes, the latest version of the pull request seems to work properly for me, thanks.

  • Latest version of pull request I interpret as....

    https://git.drupalcode.org/project/markdown/-/merge_requests/29.diff

    I applied and it seems to work! :)

  • Status changed to RTBC 12 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rclemings

    Works for me too. Setting to RTBC.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mayankguptadotcom Charlotte

    Tested #14 on DDEV.
    Works fine on Drupal 10.2.2
    PHP 8.1.26

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom Janner

    I need to make some changes to a couple of filters and am reluctant to so because of some of the reports in this thread - in particular @Olarin's experience of the formatting being stripped after separately installing 2 of the patches posted above.

    Accordingly, would someone please confirm that the patch in #14 resolves the underlying problem and enables the subsequent editing of filters with no issues.

    This would be with version 3.0.1 of the module.

    Thanks

  • @Janner Yes, #14 works with v3.0.1

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Chris Burge

    Moving to critical. Site builders cannot create or edit text formats. There is no workaround. MR 29 resolves the issue.

    Without MR:

    1. Navigate to https://mysite.localhost/admin/config/content/formats
    2. Click on Add Text Format
    3. Observe fatal error
    4. Navigate to https://mysite.localhost/admin/config/content/formats
    5. Attempt to configure any text format
    6. Observe fatal error

    With MR:

    1. Navigate to https://mysite.localhost/admin/config/content/formats
    2. Click on Add Text Format
    3. Observe page loads as expected
    4. Navigate to https://mysite.localhost/admin/config/content/formats
    5. Attempt to configure any text format
    6. Observe page loads as expected
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jerrac

    MR 29 worked for me today when I ran into this issue on a dev site.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States geerlingguy

    Ditto.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Tilottama11

    After applying MR 29 , on page load I got another issue
    Fatal error: Could not check compatibility between Drupal\markdown\Form\SubformState::createForSubform(array &$subform, array &$parent_form, Drupal\Core\Form\FormStateInterface $parent_form_state, ?Drupal\markdown\Form\FormInterface $subform_form_object = null) and Drupal\Core\Form\SubformState::createForSubform(array &$subform, array &$parent_form, Drupal\Core\Form\FormStateInterface $parent_form_state, ?Drupal\Core\Form\FormInterface $subform_form_object = null), because class Drupal\markdown\Form\FormInterface is not available in \web\modules\contrib\markdown\src\Form\SubformState.php on line 57

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom opdavies Wales

    MR 29 works for me, too.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada bisonbleu

    This fix does not appear to be available in the latest Dev version?
    I'm still getting the above reported error :/

  • Hi,
    I've tried using this https://git.drupalcode.org/issue/markdown-3409277/-/tree/3409277-subform..., but I'm still encountering the same issue. I am using Drupal 10.3.0 and Markdown 3.0.1.
    Has anyone found a fix for this?

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark lennart

    Using Drupal 10.3.1 and Markdown 3.0.1

    I am getting a 500 error / WSOD on adding a new or editing of any existing text input format.
    I am also getting the 500 error / WSOD on /admin/config/content/markdown/commonmark

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand jonathan_hunt

    The patch in MR !29 works for me with Markdown 3.0.1. on Drupal 10.3.6. It would be great to get it merged, thanks.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance pacproduct

    Upgrading from Drupal 10.1 to Drupal 10.3.6 broke the markdown module as explained in this issue, and the patch in MR !29 works for me too and does solve the issue with Markdown 3.0.1. Thanks!

Production build 0.71.5 2024