Skip to content

Commit

Permalink
Prevent race condition in loadSource by writing to a temporary file
Browse files Browse the repository at this point in the history
  • Loading branch information
C3realGuy committed Feb 6, 2017
1 parent 9bc6cba commit de8a0d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/app/Subs-CachePHP.php
Expand Up @@ -15,8 +15,10 @@
// Build the cached version of our source file
function cache_source_file($source, $dest)
{
apply_plugin_mods($source, $dest);
minify_php($dest);
$dest_locked = substr($dest, 0, -4).'-'.mt_rand(10000, 99999).'.php';
apply_plugin_mods($source, $dest_locked);
minify_php($dest_locked);
rename($dest_locked, $dest);
}

// Cache a minified PHP file.
Expand Down

0 comments on commit de8a0d3

Please sign in to comment.