Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid/Source/Source.php htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated #1115

Open
Skargne opened this issue Dec 5, 2024 · 0 comments

Comments

@Skargne
Copy link

Skargne commented Dec 5, 2024

Hi,
In Symfony 5.4, there is a deprecation on in Grid/Grid.php line 579 :

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated

Here is a possible fix :

private function removeAccents($str)
    {
+        if(!$str instanceof string)
+        {
+            return $str;
+        }
        $entStr = htmlentities($str, ENT_NOQUOTES, 'UTF-8');
        $noaccentStr = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $entStr);

        return preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $noaccentStr);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant