check_markup(): $format_id must be required, $langcode should default to LANGCODE_NOT_SPECIFIED

Created on 10 October 2009, over 14 years ago
Updated 1 April 2023, about 1 year ago

Problem

  1. The $format_id parameter to check_markup() is optional currently, even though calling code should always know the text format in which the user input has been created.
  2. The $langcode parameter defaults to an empty string, even though there is a language code for denoting unspecified language.

Proposed solution

  1. Make $format_id required. Still allow to pass NULL to use the fallback format in edge-case scenarios.

  2. Make $langcode default to LanguageInterface::LANGCODE_NOT_SPECIFIED, so text is always processed with a proper language code.

Spin-off from #569238: Make check_markup() not cache by default β†’ :

Discussion revealed that all code totally has to pass a $langcode to check_markup(), so all filters can safely rely on it. Aforementioned issue also contained a patch that tried to fix the invocations we have in core to pass the proper language code for filtered nodes, comments, and all that.

We want to drop the default of '' for the $langcode argument for check_markup(), because implementations should _always_ pass a language code.

πŸ› Bug report
Status

Needs work

Version

9.5

Component
FilterΒ  β†’

Last updated 1 day ago

No maintainer
Created by

πŸ‡©πŸ‡ͺGermany sun Karlsruhe

Live updates comments and jobs are added and updated live.
  • API clean-up

    Refactors an existing API or subsystem for consistency, performance, modularization, flexibility, third-party integration, etc. May imply an API change. Frequently used during the Code Slush phase of the release cycle.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    This was an issue at a bugsmash group triage. After reading the comments and looking at the patch and the existing code, this appear to still be relevant. This does need an Issue Summary update. And it needs tests, see #52 and #53.

Production build 0.69.0 2024