Issue #3277342: Fix substr issue for php8.
Closes #3277342
In PHP 7 substr returns the false
but in PHP 8 it returns the ''
empty string. It produces an issue when site can't be loaded if JShrink is used.
Current solution keeps backward compatibility.
Edited by Serhii Puchkovskyi