Skip to content

Commit

Permalink
Merge branch '1.x' into 2.x
Browse files Browse the repository at this point in the history
* 1.x:
  Update CHANGELOG
  Revert "bug #3499 Fix: A template name cannot be an absolute path (mvorisek)"
  • Loading branch information
fabpot committed May 16, 2021
2 parents f602d0c + f7bfa2e commit ceb4de0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@

# 1.44.4 (2021-XX-XX)

* n/a
* Revert "Throw a proper exception when a template name is an absolute path (as it has never been supported)"

# 1.44.3 (2021-05-12)

Expand Down
4 changes: 0 additions & 4 deletions src/Loader/FilesystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ private 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 @@ -33,13 +33,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 @@ -65,14 +63,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 ceb4de0

Please sign in to comment.