Problem/Motivation
Having a really long HTML tag (e.g. < img > with src:data/image...) makes preg_split fail and return false. On PHP 7.4 this throws a warning ("Warning: count(): Parameter must be an array or an object that implements Countable in _filter_url() (line 535 of core/modules/filter/filter.module).") and makes the field render empty, on PHP 8.0 this throws a fatal error.
Steps to reproduce
1) Have a text format that has Convert URLs into links
enabled
2) Using that text format, add a node with content like this: https://gist.github.com/kporras07/618b3bf4cd77ff57fcd5034262220e99
3) Visit the node
4) You will get the warning and empty node or the fatal error depending on your PHP version
Proposed resolution
If $chunks
is empty, keep $text
.
Remaining tasks
1) Provide a patch
2) Review the patch
3) Commit :)
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
Probably not needed