Skip to content

Commit

Permalink
Fix. Concatenating variables fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Glomberg committed Dec 4, 2023
1 parent d0ba8e9 commit 7b9304e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Modules/Variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,20 @@ public function concatenateVars($_key)
$this->tokens->next2->type === 'T_CONSTANT_ENCAPSED_STRING'
) {
$var_first_declaration = $this->tokens->searchForward(0, $this->tokens->current[1]); // 10

if ( ! $var_first_declaration ) {
return false;
}

$var_expression = $this->tokens->getRange(
$this->tokens[$var_first_declaration][3],
$this->tokens->searchForward($this->tokens[$var_first_declaration][3], ';') - 1
);

if ( ! count($var_expression) ) {
return false;
}

$tokens_of_variable_for_concat = $this->tokens->getRange(
$this->tokens->current[3] + 3,
$this->tokens->searchForward($this->tokens->current[3], ';') - 1
Expand Down Expand Up @@ -452,12 +461,18 @@ public function replaceVars($_key)
if ( $this->tokens->next1->value === '(' ) {
$var_first_declaration = $this->tokens->searchForward(0, (string)$this->tokens->current->value); // 10

if ( ! $var_first_declaration ) {
return false;
}

$var_expression = $this->tokens->getRange(
$this->tokens[$var_first_declaration][3],
$this->tokens->searchForward($this->tokens[$var_first_declaration][3], ';') - 1
);

$this->tokens->current->value = trim($var_expression[2][1], '\'\"');
if ( isset($var_expression[2][1]) ) {
$this->tokens->current->value = trim($var_expression[2][1], '\'\"');
}
}
}
}
Expand Down

0 comments on commit 7b9304e

Please sign in to comment.