Problem/Motivation
On the add entity queue and subqueue form pages we have error with PHP 8.1.
Error:
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).
Steps to reproduce
- Install Drupal Core with PHP 8.1
- Install end enable the Entityqueue module
- Go to the Add Entityqueue page (/admin/structure/entityqueue/add)
You will see an error:
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).
The same error if we want to add a subqueue for already existing entity queue, steps:
- Install Drupal Core with PHP 8.1
- Install end enable the Entityqueue module
- Go to the Add Entityqueue page (/admin/structure/entityqueue/add)
- Create a new queue for any entity but with the Multiple subqueues Queue type
- After, try to create a subqueue
Proposed resolution
Add additional check for titles where string arguments can be NULL.
Remaining tasks
[none]
User interface changes
[none]
API changes
[none]
Data model changes
[none]
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3298778-6.patch | 4.1 KB | amateescu |
| #2 | entityqueue-fix_deprecated_function_htmlspecialchars_error-3298778-2.patch | 1.47 KB | tibezh |
Issue fork entityqueue-3298778
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:
- 3298778-php-8.1-deprecated
changes, plain diff MR !11
Comments
Comment #2
tibezh commentedHere a patch.
Comment #5
ruslan piskarovAlso fixed a fatal error: count(): Argument #1 ($value) must be of type Countable|array, null given in count() .
Comment #7
amateescu commentedThanks for opening this issue and for the patches! I tweaked the fixes a bit and committed the patch attached.