Skip to content

Commit

Permalink
bug #2178 made it possible to store templates with vfsStream (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

made it possible to store templates with vfsStream

closes #2166

Commits
-------

4d60758 made it possible to store templates with vfsStream
  • Loading branch information
fabpot committed Oct 13, 2016
2 parents 3879038 + 4d60758 commit ef942f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* 1.26.2 (2016-XX-XX)

* Fixed template paths when a template name contains a protocol like vfs://
* improved debugging with Twig_Sandbox_SecurityError exceptions for disallowed methods and properties

* 1.26.1 (2016-10-05)
Expand Down
4 changes: 2 additions & 2 deletions lib/Twig/Loader/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ protected function validateName($name)
private function normalizePath($path)
{
$parts = explode('/', str_replace('\\', '/', $path));
$isPhar = strpos($path, 'phar://') === 0;
$hasProto = false !== strpos($path, '://');
$new = array();
foreach ($parts as $i => $part) {
if ('..' === $part) {
array_pop($new);
} elseif ('.' !== $part && ('' !== $part || 0 === $i || $isPhar && $i < 3)) {
} elseif ('.' !== $part && ('' !== $part || 0 === $i || $hasProto && $i < 3)) {
$new[] = $part;
}
}
Expand Down

0 comments on commit ef942f6

Please sign in to comment.