Problem/Motivation

Drupal 9.3.15 has an issue with Deprecated function: htmlspecialchars() with combination of PHP 8.1.4

Steps:
1.Go to Structure > Taxonomy
2. Add new vocabulary

Following warning appears :

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).

Issue fork drupal-3283755

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

coaston created an issue. See original summary.

cilefen’s picture

Title: Deprecated function: htmlspecialchars() » htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Html::escape()
Status: Active » Postponed (maintainer needs more info)

Please get a stack trace.

Retitling because the function is not deprecated.

coaston’s picture

I just added video.

Drupal 9.3.15
Php 8.1.4 memory limit 256M
Linux red hat 2.4.6 and mysql db 5.7.38

cilefen’s picture

We need a stack trace not a video. ;-)

Can you confirm this is reproducible by installing Drupal Core alone? I suspect a contributed module. A stack trace will reveal that.

coaston’s picture

Hi cilefen, can you guide me?

I tried to insall devel module but the whole site crashed, so any other idea?

I do have same issue on my test and prod enviroment so havent tried on clean drupal but I am sure when i had drupal 9.3.15 and php 7.4+ there was not any error. It started when i upgraded php to 8.1.4

But i do have 2 other modules installed which work with taxonomy so wil try to unistall them to see the difference.

coaston’s picture

I just unistalled both referenced modules and still the same issue.

So can you provide the way how can I enable stack trace please?

cilefen’s picture

I don't know what you mean by "the referenced modules".

Can you reproduce the deprecation warning starting by installing Drupal or at https://simplytest.me?

coaston’s picture

Hi Cilefen,

Finally i was able to install "Devel" module with all required libraries so now it works and does not crash. Hence I was able to read backtrace log that the problem was caused by another module : https://www.drupal.org/project/simplify

Once I uninstalled it. The error disappeared!

Thank you for your time. I learned a lot today thanks to you.

cilefen’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
Related issues: +#3283858: htmlspecialchars(): Passing null to parameter #1

Arnoldski made their first commit to this issue’s fork.