Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.4] Hotfix - isExpired correct file path #171

Merged
merged 1 commit into from Nov 28, 2017
Merged

[2.4] Hotfix - isExpired correct file path #171

merged 1 commit into from Nov 28, 2017

Conversation

michalbundyra
Copy link
Contributor

@michalbundyra michalbundyra commented Nov 28, 2017

Method was called from getContent with the full file path (see lines 36 and 43) and inside the method isExpired baseDir was added another time (see line 57), so as the result we have: "baseDir/baseDir/fileName.ext"

public function getContent($file)
{
$file = $this->baseDir . $file;
if ($this->baseDir && !Latte\Helpers::startsWith($this->normalizePath($file), $this->baseDir)) {
throw new \RuntimeException("Template '$file' is not within the allowed path '$this->baseDir'.");
} elseif (!is_file($file)) {
throw new \RuntimeException("Missing template file '$file'.");
} elseif ($this->isExpired($file, time())) {

public function isExpired($file, $time)
{
return @filemtime($this->baseDir . $file) > $time; // @ - stat may fail

Fix for 2.4 branch, but it should be also fixed on master.

  • bug fix? yes/no
  • new feature? yes/no
  • BC break? yes/no
  • doc PR: nette/docs#???

Method was called from getContent with the full file path
and inside the method baseDir was added another time,
so as the result we have: "baseDir/baseDir/fileName.ext"
knight
knight approved these changes Nov 28, 2017
@dg
Copy link
Member

@dg dg commented Nov 28, 2017

Thanks!

@dg dg merged commit 2010e6e into nette:v2.4 Nov 28, 2017
2 checks passed
dg pushed a commit that referenced this issue Nov 28, 2017
Method was called from getContent with the full file path
and inside the method baseDir was added another time,
so as the result we have: "baseDir/baseDir/fileName.ext"
@michalbundyra michalbundyra deleted the hotfix/is-expired branch Nov 28, 2017
dg pushed a commit that referenced this issue Nov 28, 2017
Method was called from getContent with the full file path
and inside the method baseDir was added another time,
so as the result we have: "baseDir/baseDir/fileName.ext"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants