Make some strlen() calls be safe for PHP 8.0
Since PHP 8.0, passing null
to strlen()
is deprecated.
Thus instead check if a variable (whether string or not)
is null
or empty if we do not care about the actual byte
length of a string anyway.
Bug: T342244