mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 08:17:12 +02:00
Fix issue #151, minor correction to FileCompiler affecting single lines that contain both className and function from ProcessWire namespace at the same time
This commit is contained in:
@@ -248,7 +248,7 @@ class FileCompiler extends Wire {
|
|||||||
foreach($phpBlocks as $key => $phpBlock) {
|
foreach($phpBlocks as $key => $phpBlock) {
|
||||||
$pos = strpos($phpBlock, $phpClose);
|
$pos = strpos($phpBlock, $phpClose);
|
||||||
if($pos !== false) {
|
if($pos !== false) {
|
||||||
$closeBlock = substr($phpBlock, $phpClose + 2);
|
$closeBlock = substr($phpBlock, strlen($phpClose) + 2);
|
||||||
if(strrpos($closeBlock, '{') && strrpos($closeBlock, '}') && strrpos($closeBlock, '=')
|
if(strrpos($closeBlock, '{') && strrpos($closeBlock, '}') && strrpos($closeBlock, '=')
|
||||||
&& strrpos($closeBlock, '(') && strrpos($closeBlock, ')')
|
&& strrpos($closeBlock, '(') && strrpos($closeBlock, ')')
|
||||||
&& preg_match('/\sif\s*\(/', $closeBlock)
|
&& preg_match('/\sif\s*\(/', $closeBlock)
|
||||||
@@ -870,6 +870,7 @@ class FileCompiler extends Wire {
|
|||||||
$className = __NAMESPACE__ ? '\\' . __NAMESPACE__ . '\\' . $class : '\\' . $class;
|
$className = __NAMESPACE__ ? '\\' . __NAMESPACE__ . '\\' . $class : '\\' . $class;
|
||||||
$repl = $open . $className . $close;
|
$repl = $open . $className . $close;
|
||||||
$data = str_replace($fullMatch, $repl, $data);
|
$data = str_replace($fullMatch, $repl, $data);
|
||||||
|
$rawPHP = str_replace($fullMatch, $repl, $rawPHP);
|
||||||
$rawDequotedPHP = str_replace($fullMatch, $repl, $rawDequotedPHP);
|
$rawDequotedPHP = str_replace($fullMatch, $repl, $rawDequotedPHP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user