From 2882371d3f7a4697a27ea6bef12c161656597e8d Mon Sep 17 00:00:00 2001 From: "Robert J. Lang" Date: Sun, 11 Apr 2021 19:24:18 -0700 Subject: [PATCH] Handle numeric values in variable_get(). Fix a regression bug that messed up handling variable_get() with numeric default values. --- conversions/call.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conversions/call.inc b/conversions/call.inc index 094d65c..63c18d4 100644 --- a/conversions/call.inc +++ b/conversions/call.inc @@ -64,7 +64,7 @@ function coder_upgrade_upgrade_call_variable_get_alter(&$node, &$reader) { // DO $value = 'dynamic variable in file ' . $path . ' line ' . $node->line; } else { - $raw_value = $item->printParameter(1); + $raw_value = trim($item->printParameter(1)); // Remove extra whitespace $value_uc = strtoupper($raw_value); // Catch initialization with empty array. @@ -98,8 +98,11 @@ function coder_upgrade_upgrade_call_variable_get_alter(&$node, &$reader) { // DO $value = substr($raw_value, 1, $len - 2); } else { + // It's a numeric expression, so use it directly. + $value = $raw_value; + // something is amiss! Insert the warning. - $value = 'dynamic value in file ' . $path . ' line ' . $node->line; + //$value = 'dynamic value in file ' . $path . ' line ' . $node->line; } } }