What are the potential issues when upgrading from PHP 5.3 to 5.4 regarding htmlentities function behavior?

When upgrading from PHP 5.3 to 5.4, the htmlentities function behavior may change slightly due to changes in default encoding. To ensure consistent behavior, it is recommended to explicitly specify the encoding parameter when using htmlentities. This parameter should be set to 'UTF-8' to maintain compatibility with previous versions.

$string = "Hello, <script>alert('XSS');</script>";
$encoded_string = htmlentities($string, ENT_QUOTES, 'UTF-8');
echo $encoded_string;