Skip to content

Commit

Permalink
Fix evaluation of root name as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
twiro committed May 31, 2018
1 parent b2c4c7a commit 17dd7a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fields/field.reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public function compile(&$entry)
preg_match_all('/\{[^\}]+\}/', $expression, $matches);

// Get root node name
$root_node_name = $xpath->evaluate('name(/*)');
$root_node_name = preg_quote ((string)$xpath->evaluate('name(/*)'), '#');

// Find replacements
// including modifications for edge-cases (#35)
Expand All @@ -407,7 +407,7 @@ public function compile(&$entry)
$result = @$xpath->evaluate('string('. trim($string, '{}') . ')');
}

// Add the name of the root node if the expression only consist of '/'
// Add the name of the root node if the expression only consists of '/'
// Fixes expression 2.A
else if ($match === '{/}') {
$result = @$xpath->evaluate('string(/'. $root_node_name . ')');
Expand Down

0 comments on commit 17dd7a7

Please sign in to comment.