mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
Remove UTF-8 BOM and CRLF in templates when compiling them
This commit is contained in:
parent
55d3dd047c
commit
a50041007d
2 changed files with 4 additions and 1 deletions
|
|
@ -286,6 +286,9 @@ class TemplateHandler
|
|||
// detect existence of autoescape config
|
||||
$this->config->autoescape = (strpos($buff, ' autoescape="') === false) ? null : false;
|
||||
|
||||
// remove UTF-8 BOM and convert CRLF to LF
|
||||
$buff = preg_replace(['/^\xEF\xBB\xBF/', '/\r\n/'], ['', "\n"], $buff);
|
||||
|
||||
// replace comments
|
||||
$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
|
||||
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
|
|||
'?><input foo="bar" /> <?php if($__Context->foo->bar ?? false){ ?><img alt="alt" src="' . $this->baseurl . 'tests/unit/classes/common/mobile.gif" /><?php } ?>'
|
||||
),
|
||||
array(
|
||||
'<input foo="bar" />' . "\n" . '<input foo="bar" /> <img cond="$foo->bar" alt="alt" src="../common/mobile.gif" />',
|
||||
'<input foo="bar" />' . "\r\n" . '<input foo="bar" /> <img cond="$foo->bar" alt="alt" src="../common/mobile.gif" />',
|
||||
'?><input foo="bar" />' . "\n" . '<input foo="bar" /> <?php if($__Context->foo->bar ?? false){ ?><img alt="alt" src="' . $this->baseurl . 'tests/unit/classes/common/mobile.gif" /><?php } ?>'
|
||||
),
|
||||
array(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue