From 1c563f340b393347ede2e5ac917499ae1d946112 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 3 Sep 2015 20:40:47 -0500 Subject: [PATCH] Issue 102: Potential race condition when compiling templates --- pluf/src/Pluf/Template.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pluf/src/Pluf/Template.php b/pluf/src/Pluf/Template.php index 25562e5..5ea86a1 100644 --- a/pluf/src/Pluf/Template.php +++ b/pluf/src/Pluf/Template.php @@ -144,9 +144,11 @@ public static function render($c) {$t = $c; ?>'.$this->template_content.'template_content, strlen($this->template_content)); // Lock released, read access is possible - flock($fp, LOCK_UN); + 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));