From f5874a9db4ebac216a6b11c2c4aa13ab2ecb4d7b Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Fri, 28 Feb 2025 01:54:13 +0300 Subject: [PATCH] Adding extra check if def macros are not actually present in the source --- jsm.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jsm.inc.php b/jsm.inc.php index 6de4cb9..c3f9dc9 100644 --- a/jsm.inc.php +++ b/jsm.inc.php @@ -523,7 +523,12 @@ class JSM private function _extractScriptDefs(string $file, string $txt) : string { - if(strpos($txt, 'def') === false) + $strpos = strpos($txt, 'def'); + if($strpos === false) + return $txt; + + //let's extra check if newline symbols preceed 'def' + if($strpos > 0 && !($txt[$strpos-1] === "\n" || $txt[$strpos-1] === "\r")) return $txt; //NOTE: make it more robust