htmlspecialchars() expects parameter 1 to be string, array given

Created on 31 May 2019, about 5 years ago
Updated 27 March 2023, over 1 year ago

When constructing @link theme_render the rendered output of @endlink is passed to Html::escape() as array in key '#markup'. If the '#plain_text' key is not used warnings are produced. Here is a patch that handles that.

🐛 Bug report
Status

Needs work

Version

9.5

Component
Markup 

Last updated 5 days ago

No maintainer
Created by

🇧🇬Bulgaria Plamen.Penev

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

  • 🇮🇳India Nikhil_110

    Attached patch against Drupal 10.1.x

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Gauravvv Delhi, India

    Re-rolled patch #2, for 9.5.x. Patch #2 no longer applies to 9.5.x. Not attaching interdiff as no patch is applying to 9.5

  • Status changed to Needs work over 1 year ago
  • 🇮🇳India ameymudras

    Would be really helpful if we can have testing steps in the description. Couple of suggestions after code review:

    1. we can make use of isset instead of array_key_exists since its faster

    if (is_array($text) && isset($text['#markup'])) {

    2. The following comment needs to be better worded

    // Handle strings that are passed in array as value in the #markup key.

  • First commit to issue fork.
  • @rpayanm opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇺🇾Uruguay rpayanm

    I applied the suggestions please review.

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    The issue summary should be updated to include the problem, proposed solution, and remaining tasks

    Title also should be updated to show the problem not the ticket number.

    Also needs test coverage.

  • 🇺🇾Uruguay rpayanm

    Ups, sorry.

Production build 0.69.0 2024