@@ -675,26 +675,27 @@ public function validateHtml($file, $key, $sourceString, $originString)
675675 $ ignoreAdditional = true ;
676676 }
677677
678- // missing closingTag allowed in: <br>, <hr>
678+ // missing closingTag allowed in: <br>, <hr>, <img>
679679 $ allowedMissingClosingTag = array (
680680 'br ' ,
681681 'hr ' ,
682+ 'img ' ,
682683 );
683684
684685 $ tag = (strpos ($ possibleHtml , ' ' ) !== false ) ? substr ($ possibleHtml , 1 , strpos ($ possibleHtml , ' ' ) - 1 ) : substr ($ possibleHtml , 1 , strpos ($ possibleHtml , '> ' ) - 1 );
685686 $ tag = ($ openingTag ) ? $ tag : substr ($ tag , 1 );
686687
687688 if ($ openingTag )
688689 {
689- if (in_array ($ tag , $ openTags ) && ! in_array ( $ tag , $ allowedMissingClosingTag ) )
690+ if (in_array ($ tag , $ openTags ))
690691 {
691692 if (!$ failedUnclosed )
692693 {
693694 $ this ->output ->addMessage (Output::FATAL , 'String is missing closing tag for html: ' . $ tag , $ file , $ key );
694695 }
695696 $ failedUnclosed = true ;
696697 }
697- else if (substr ($ possibleHtml , -3 ) !== ' /> ' )
698+ else if (( substr ($ possibleHtml , -3 ) !== ' /> ' ) && ! in_array ( $ tag , $ allowedMissingClosingTag ) )
698699 {
699700 $ openTags [] = $ tag ;
700701 }
@@ -755,7 +756,7 @@ public function validateHtml($file, $key, $sourceString, $originString)
755756 }
756757 }
757758
758- if (!empty ($ openTags ) && !$ failedUnclosed && ! in_array ( $ openTags [ 0 ], $ allowedMissingClosingTag ) )
759+ if (!empty ($ openTags ) && !$ failedUnclosed )
759760 {
760761 $ this ->output ->addMessage (Output::FATAL , 'String is missing closing tag for html: ' . $ openTags [0 ], $ file , $ key );
761762 }
0 commit comments