Problem/Motivation
When a module implements hook_toolbar with a #type => 'toolbar_item' but without a 'tab', the implementation triggers a PHP deprecation notice on PHP8.1:
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).
Proposed resolution
Fix the deprecation notice
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3259807-2.patch | 984 bytes | idebr |
| #2 | 3259807-2-test-only.patch | 507 bytes | idebr |
Comments
Comment #2
idebr commentedAttached patch fixes the deprecation notice on PHP8.1
Comment #3
anneke_vde commentedI tested this with PHP8.1, the deprecation notice is gone when I applied the patch.
Comment #6
catchCommitted b9e078a and pushed to 10.0.x. Thanks! Also cherry-picked to 9.4.x and 9.3.x.
Comment #8
liam morland