Problem/Motivation
If a blank string is passed to ProcessedText::preRenderText() there's no reason to run any of the logic processing it, is there?
Steps to reproduce
Pass a blank string through ProcessedText::preRenderText()
Proposed resolution
Return early in ProcessedText::preRenderText() if $element['#text'] is a blank string.
Remaining tasks
Provide a MR.
Add test coverage.
User interface changes
n/a
Introduced terminology
n/a
API changes
TBD
Data model changes
n/a
Release notes snippet
TBD
Issue fork drupal-3554602
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
Comment #3
damienmckennaThe MR simply returns early if the string is empty.
Comment #4
damienmckennaRelated: #3294680: PHP8.1 deprecation: str_replace(): Passing null to parameter #3
Comment #5
smustgrave commentedPossible to get a simple unit test around this
Comment #7
oily commentedAdded a unit test. Needs work.
Comment #8
harivansh commentedComment #9
harivansh commentedComment #10
oily commentedNow the test-only test output is:
Not sure if that error should be fixed? And a test failure should replace it..
Comment #11
smustgrave commentedLooking at the IS and MR appears to be doing more then described. If they're needed those other checks don't appear to be captured in tests.