mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: UTF-8 byte order mark gets propagated from template files (#4357)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90056 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c4e0d45742
commit
0a1392324a
@ -276,7 +276,15 @@ class SSViewer {
|
||||
return null;
|
||||
}
|
||||
|
||||
return file_get_contents(SSViewer::getTemplateFile($identifier));
|
||||
$content = file_get_contents(SSViewer::getTemplateFile($identifier));
|
||||
|
||||
// Remove UTF-8 byte order mark
|
||||
// This is only necessary if you don't have zend-multibyte enabled.
|
||||
if(substr($content, 0,3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
|
||||
$content = substr($content, 3);
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,8 +382,13 @@ class SSViewer {
|
||||
}
|
||||
|
||||
static function parseTemplateContent($content, $template="") {
|
||||
// Add template filename comments on dev sites
|
||||
// Remove UTF-8 byte order mark:
|
||||
// This is only necessary if you don't have zend-multibyte enabled.
|
||||
if(substr($content, 0,3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
|
||||
$content = substr($content, 3);
|
||||
}
|
||||
|
||||
// Add template filename comments on dev sites
|
||||
if(Director::isDev() && self::$source_file_comments && $template && stripos($content, "<?xml") === false) {
|
||||
// If this template is a full HTML page, then put the comments just inside the HTML tag to prevent any IE glitches
|
||||
if(stripos($content, "<html") !== false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user