From cfc2f5d9af167165fe37285f8e0203c73b531e8b Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Tue, 6 Oct 2020 11:39:31 -0400 Subject: [PATCH] - Trimmed the echo and echo raw printed PHP code --- src/Syntax/EchoRawToken.php | 4 +++- src/Syntax/EchoSafeToken.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Syntax/EchoRawToken.php b/src/Syntax/EchoRawToken.php index 68c4b41..0a92328 100644 --- a/src/Syntax/EchoRawToken.php +++ b/src/Syntax/EchoRawToken.php @@ -11,7 +11,9 @@ class EchoRawToken implements Syntax { public function parse(/*\Picae\Compiler\Context*/ &$content, string &$sourceCode) { $sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) { - return ""; + $line = trim($matches[2], " \t\n\r\0\x0B;"); + + return ""; }, $sourceCode); } diff --git a/src/Syntax/EchoSafeToken.php b/src/Syntax/EchoSafeToken.php index 13c8936..1b832b4 100644 --- a/src/Syntax/EchoSafeToken.php +++ b/src/Syntax/EchoSafeToken.php @@ -21,7 +21,9 @@ class EchoSafeToken implements Syntax { public function parse(/*\Picae\Compiler\Context*/ &$context, string &$sourceCode) { $sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) { - return "flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; + $line = trim($matches[2], " \t\n\r\0\x0B;"); + + return "flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; }, $sourceCode); }