aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-27 05:48:36 +0900
committernsfisis <nsfisis@gmail.com>2026-06-27 05:48:36 +0900
commit2a3ec5d33195d7290ac0869798cad6f84f84d238 (patch)
tree22fdadb27e0810b773516237eeaeed11d5b736d6
parenta66fca3b57a1b3ed77272c2479da4efd7140ca23 (diff)
downloadphp-shirabe-2a3ec5d33195d7290ac0869798cad6f84f84d238.tar.gz
php-shirabe-2a3ec5d33195d7290ac0869798cad6f84f84d238.tar.zst
php-shirabe-2a3ec5d33195d7290ac0869798cad6f84f84d238.zip
fix(filesystem-repository): avoid RefCell double borrow on installed.php
file_put_contents_if_modified held a filesystem borrow_mut() receiver while its argument re-borrowed the same RefCell via dump_to_php_code(), panicking with "RefCell already borrowed". Build the file contents before taking the borrow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
-rw-r--r--crates/shirabe/src/repository/filesystem_repository.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs
index 30c01e8..0dae316 100644
--- a/crates/shirabe/src/repository/filesystem_repository.rs
+++ b/crates/shirabe/src/repository/filesystem_repository.rs
@@ -324,9 +324,10 @@ impl FilesystemRepository {
&repo_dir,
)?;
+ let installed_php = format!("<?php return {};\n", self.dump_to_php_code(&versions, 0));
self.filesystem.borrow_mut().file_put_contents_if_modified(
&format!("{}/installed.php", repo_dir),
- &format!("<?php return {};\n", self.dump_to_php_code(&versions, 0)),
+ &installed_php,
);
self.filesystem.borrow_mut().file_put_contents_if_modified(
&format!("{}/InstalledVersions.php", repo_dir),