Fix conf array parser stopping early at ) in comments
Non-greedy (.*?) stopped at the first ) found, which could be inside a comment like '# gracefully stop fallback (not caught by ...)'. Anchoring the closing paren to start-of-line (^\s*\)) ensures it only matches the array's actual closing paren, not ) inside comment text.
This commit is contained in:
@@ -82,7 +82,7 @@ function vv_job_tree(): array {
|
|||||||
// Parse a bash array from master.conf content and return its script paths.
|
// Parse a bash array from master.conf content and return its script paths.
|
||||||
// Handles entries with inline args ("script.sh --flag") and skips commented lines (#"...").
|
// Handles entries with inline args ("script.sh --flag") and skips commented lines (#"...").
|
||||||
function vv_parse_conf_array(string $conf, string $varName): array {
|
function vv_parse_conf_array(string $conf, string $varName): array {
|
||||||
if (!preg_match('/^\s*' . preg_quote($varName, '/') . '\s*=\s*\((.*?)\)/ms', $conf, $m)) {
|
if (!preg_match('/^\s*' . preg_quote($varName, '/') . '\s*=\s*\((.*?)^\s*\)/ms', $conf, $m)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$scripts = [];
|
$scripts = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user