Skip to content

Commit

Permalink
Revert "bug twigphp#3499 Fix: A template name cannot be an absolute p…
Browse files Browse the repository at this point in the history
…ath (mvorisek)"

This reverts commit 83f26e4, reversing
changes made to f5d3c70.
  • Loading branch information
fabpot committed May 16, 2021
1 parent 35f8b78 commit 124f10c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
4 changes: 0 additions & 4 deletions src/Loader/FilesystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ protected function validateName($name)
throw new LoaderError('A template name cannot contain NUL bytes.');
}

if ($this->isAbsolutePath($name)) {
throw new LoaderError(sprintf('A template name cannot be an absolute path (%s).', $name));
}

$name = ltrim($name, '/');
$parts = explode('/', $name);
$level = 0;
Expand Down
12 changes: 1 addition & 11 deletions tests/Loader/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ public function testSecurity($template)
{
$loader = new FilesystemLoader([__DIR__.'/../Fixtures']);

$this->expectException(LoaderError::class);
try {
$loader->getCacheKey($template);
$this->fail();
} catch (LoaderError $e) {
$this->assertStringNotContainsString('Unable to find template', $e->getMessage());

throw $e;
}
}

Expand All @@ -64,14 +62,6 @@ public function getSecurityTests()
['filters\\\\..\\\\..\\\\AutoloaderTest.php'],
['filters\\//../\\/\\..\\AutoloaderTest.php'],
['/../AutoloaderTest.php'],
['/AutoloaderTest.php'],
['\\AutoloaderTest.php'],
['//AutoloaderTest.php'],
['\\\\AutoloaderTest.php'],
['/./AutoloaderTest.php'],
['\\.\\AutoloaderTest.php'],
['C:/AutoloaderTest.php'],
['C:\\AutoloaderTest.php'],
];
}

Expand Down

0 comments on commit 124f10c

Please sign in to comment.