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 node with content like this: https://gist.github.com/kporras07/618b3bf4cd77ff57fcd5034262220e99
2) Visit the node
3) You will get the warning and empty node or the fatal error depending on your PHP version
Proposed resolution
Wrap the for inside an if to avoid triggering this error.
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