Skip to content

Commit

Permalink
Fixed possible bad beginBody()/endBody() placement
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 16, 2019
1 parent 1941f73 commit 0e420e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed a bug where Craft could auto-place the `{{ beginBody() }}` and `{{ endBody() }}` tags in the wrong places.

## 3.1.12 - 2019-02-15

### Fixed
Expand Down
5 changes: 2 additions & 3 deletions src/web/twig/nodevisitors/EventTagAdder.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ private function _processTextNode(\Twig_Node_Text $node, \Twig_Environment $env)
} else {
// Did we just find the `>`?
if (preg_match('/^[^>]*>/', $data, $matches)) {

$this->_findingBeginBody = false;
static::$foundBeginBody = true;
$beginBodyPos = strlen($matches[0]);
Expand Down Expand Up @@ -142,9 +141,9 @@ private function _insertEventNode(\Twig_Node_Text $node, \Twig_Environment $env,
$splitLine = $startLine + substr_count($preSplitHtml, "\n");

return new \Twig_Node([
$this->_processTextNode(new \Twig_Node_Text($preSplitHtml, $startLine), $env),
new \Twig_Node_Text($preSplitHtml, $startLine),
new \Twig_Node_Do(new \Twig_Node_Expression_Function($functionName, new \Twig_Node(), $splitLine), $splitLine),
$this->_processTextNode(new \Twig_Node_Text($postSplitHtml, $splitLine), $env)
new \Twig_Node_Text($postSplitHtml, $splitLine),
], [], $startLine);
}
}

0 comments on commit 0e420e6

Please sign in to comment.