From 43986173fb449bf0fb967a0d613896f2e3d6b4da Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Sun, 8 Jan 2017 06:52:13 -0500 Subject: [PATCH] Fix issue #151, minor correction to FileCompiler affecting single lines that contain both className and function from ProcessWire namespace at the same time --- wire/core/FileCompiler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wire/core/FileCompiler.php b/wire/core/FileCompiler.php index 073c8bdf..dbfc4437 100644 --- a/wire/core/FileCompiler.php +++ b/wire/core/FileCompiler.php @@ -248,7 +248,7 @@ class FileCompiler extends Wire { foreach($phpBlocks as $key => $phpBlock) { $pos = strpos($phpBlock, $phpClose); if($pos !== false) { - $closeBlock = substr($phpBlock, $phpClose + 2); + $closeBlock = substr($phpBlock, strlen($phpClose) + 2); if(strrpos($closeBlock, '{') && strrpos($closeBlock, '}') && strrpos($closeBlock, '=') && strrpos($closeBlock, '(') && strrpos($closeBlock, ')') && preg_match('/\sif\s*\(/', $closeBlock) @@ -870,6 +870,7 @@ class FileCompiler extends Wire { $className = __NAMESPACE__ ? '\\' . __NAMESPACE__ . '\\' . $class : '\\' . $class; $repl = $open . $className . $close; $data = str_replace($fullMatch, $repl, $data); + $rawPHP = str_replace($fullMatch, $repl, $rawPHP); $rawDequotedPHP = str_replace($fullMatch, $repl, $rawDequotedPHP); } }