From drupal core 11.3.1, create method of Drupal\markdown\Util\FilterHtml conflict dependency injection interface of the drupal core.

PHP Fatal error: Declaration of Drupal\markdown\Util\FilterHtml::create($allowedHtml = '') must be compatible with Drupal\Core\Plugin\PluginBase::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) in /app/web/modules/contrib/markdown/src/Util/FilterHtml.php on line 35

Steps to reproduce:
1. Install drupal core 11.3.1
2. Install markdown module.
3. Add a text format to use the markdown filter.
4. Add a node text field to use the text format created in step 3.
5. Add the node, input some markdown to the text field, and view the node.

Issue fork markdown-3564814

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

司南 created an issue. See original summary.

司南’s picture

Title: create method conflict di interface » create method conflict with DI interface
Issue summary: View changes

司南’s picture

Status: Needs work » Needs review
joelpittet’s picture

Try the MR in #3373147: Fix phpstan deprecation errors it might fix this. Thanks for reporting it.

Could you add steps to reproduce the problem?

司南’s picture

Issue summary: View changes

No, this is not a phpstan error. #3373147: Fix phpstan deprecation errors is not killing this bug.

  • joelpittet committed ff032a60 on 3.0.x authored by 司南
    fix: #3564814 create method conflict with DI interface
    
    By: 司南
    By:...
joelpittet’s picture

Status: Needs review » Fixed

I see it was a result of #3452852: Add create() factory method with autowired parameters to PluginBase in D11.3. I was tempted to backport and override the create method to match D11 but that still messes with the public signature so... your solution is less code changes and the auto-wiring will work in D11 (though it's use isn't much here). Thanks again for bringing this to my attention.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.