Depreciated PHP 8.2

Bonjour,

Je suis tombé sur un : Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in \plugins\auto\image_responsive\v10.0.6\image_responsive_fonctions.php on line 138

Raison : extraire_attribut renvoit "null lorsque l’attribut n’existe pas."

Solution, remplacer : if (strlen($alt) == 0) $img = inserer_attribut($img, "alt", ""); par if (!is_null($alt) && strlen($alt) == 0) $img = inserer_attribut($img, "alt", ""); pour ne pas insérer d'attribut vide s'il n'y en avait pas

ou par if (is_null($alt) || strlen($alt) == 0) $img = inserer_attribut($img, "alt", ""); pour insérer un attribut alt vide même quand il n'y en avait aucun (ça me semble mieux).

Modification effectuée par jeanmarie