Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

[RFC] Remove UTF-8 BOM of files before combining them #8689

Merged
merged 1 commit into from
Apr 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions system/modules/core/library/Contao/Combiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ public function getCombinedFile($strUrl=null)
{
$content = file_get_contents(TL_ROOT . '/' . $arrFile['name']);

// Remove UTF-8 BOM
if (strncmp($content, "\xEF\xBB\xBF", 3) === 0)
{
$content = substr($content, 3);
}

// HOOK: modify the file content
if (isset($GLOBALS['TL_HOOKS']['getCombinedFile']) && is_array($GLOBALS['TL_HOOKS']['getCombinedFile']))
{
Expand Down