Issue 102: Potential race condition when compiling templates

This commit is contained in:
Nathan Adams 2015-09-03 20:40:47 -05:00
parent 90ce6fda4c
commit 1c563f340b

View File

@ -145,8 +145,10 @@ public static function render($c) {$t = $c; ?>'.$this->template_content.'<?php }
fwrite($fp, $this->template_content, strlen($this->template_content));
// Lock released, read access is possible
flock($fp, LOCK_UN);
fflush($fp);
fclose($fp);
@chmod($this->compiled_template, 0777);
clearstatcache();
return true;
} else {
throw new Exception(sprintf(__('Cannot write the compiled template: %s'), $this->compiled_template));