소스 검색

HtmlHelper::wrapNewLines return empty string if input is empty

alexlcdee 8 년 전
부모
커밋
3a0f5e5960
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/helpers/HtmlHelper.php

+ 4 - 0
src/helpers/HtmlHelper.php

@@ -25,6 +25,10 @@ class HtmlHelper
      */
     public static function wrapNewlines($content, $tag = 'p', $htmlOptions = [])
     {
+        $content = trim($content);
+        if ($content === '') {
+            return '';
+        }
         $filteredNewLinesContent = preg_replace('/((\r?\n)(?:\r?\n))/', '$2', $content);
         $lines = preg_split('/\r?\n/', $filteredNewLinesContent);