mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 18:36:53 +00:00
made it possible to store templates with vfsStream
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -257,12 +257,12 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user