فهرست منبع

Return false when the configuration file cannot be replaced (#9580)

Minz_Configuration::save() discarded the result of the rename() that
installs the new configuration file, so a failed replacement was
reported as a successful save and left the temporary file behind.

Co-authored-by: Raed <Raed2180416@users.noreply.github.com>
Raed 6 ساعت پیش
والد
کامیت
1a5a2aefa6
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      lib/Minz/Configuration.php

+ 4 - 1
lib/Minz/Configuration.php

@@ -235,7 +235,10 @@ class Minz_Configuration {
 			return false;
 		}
 
-		@rename($tmp_filename, $this->config_filename);
+		if (!@rename($tmp_filename, $this->config_filename)) {
+			@unlink($tmp_filename);
+			return false;
+		}
 
 		// Clear PHP cache for include
 		if (function_exists('opcache_invalidate')) {