Skip to content

Cast to string when passing to MailFormatHelper::htmlToText()#5218

Merged
weitzman merged 3 commits into11.xfrom
php8.1-warnings-htmlToText
Sep 5, 2022
Merged

Cast to string when passing to MailFormatHelper::htmlToText()#5218
weitzman merged 3 commits into11.xfrom
php8.1-warnings-htmlToText

Conversation

@claudiu-cristea
Copy link
Member

@claudiu-cristea claudiu-cristea commented Sep 3, 2022

When running drush core:requirements on PHP 8.1 I'm getting:

[error]  Message: /Deprecated function/: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Html::escape() (line 424 of /core/lib/Drupal/Component/Utility/Html.php/).
Drupal\Component\Utility\Html::escape(NULL) (Line: 262)
Drupal\Component\Render\FormattableMarkup::placeholderEscape(NULL) (Line: 232)
Drupal\Component\Render\FormattableMarkup::placeholderFormat('%profile_name (%profile-%version)', Array) (Line: 195)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
str_replace('', '', Object) (Line: 69)
Drupal\Component\Utility\Xss::filter(Object, Array) (Line: 117)
Drupal\Core\Mail\MailFormatHelper::htmlToText(Object) (Line: 23)
Drush\Drupal\DrupalUtil::drushRender(Object) (Line: 125)
Drush\Drupal\Commands\core\DrupalCommands->requirements(Array)
...

The issue is that we're passing TranslatableMarkup instances.

@claudiu-cristea claudiu-cristea force-pushed the php8.1-warnings-htmlToText branch from 1669037 to 1e25b65 Compare September 4, 2022 13:04
@weitzman weitzman merged commit 8e4b72a into 11.x Sep 5, 2022
@weitzman weitzman deleted the php8.1-warnings-htmlToText branch September 5, 2022 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants