Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The SafeMarkup class has been deprecated since 8.0.0 but we didn't have deprecation testing then or a policy to add @trigger_error()
Handling \Drupal\Component\Utility\SafeMarkup::format() in a separate issue because it is still in use - see #2958429: Properly deprecate SafeMarkup::format()
Proposed resolution
Add @trigger_error()
and improve the tests to test this.
Remaining tasks
User interface changes
None
API changes
None - this is already documented at https://www.drupal.org/node/2549395
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#4 | 2958407-4.patch | 8.08 KB | alexpott |
#4 | 2-4-interdiff.txt | 4.52 KB | alexpott |
Comments
Comment #2
alexpottHere's a patch
Comment #3
alexpottGoing to handle instances of SafeMarkup mention without ::format here as well.
Comment #4
alexpottHere's a patch that addresses #2958429-7: Properly deprecate SafeMarkup::format() - thanks @andypost.
Comment #5
andypostwhy this hunk removed? I can't find similar test case for formattable markup
Comment #6
alexpott@andypost that assertion is a relic of the time when we had a list of safe strings. Fortunately we don’t have that anymore and the equivalent assertion would be nonsense - it’d be assertSame($arg instanceof SafeMarkupTestMarkup, $arg instanceof MarkupInterface).
The point of the test was to ensure $arg didn’t become safe due to the list.
Comment #7
andypostAha yes, we always escape arguments now
Comment #9
catchCommitted fdf37cf and pushed to 8.6.x. Thanks!