Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions allowed_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ bind! {
_ZEND_IS_VARIADIC_BIT,
_ZEND_SEND_MODE_SHIFT,
_ZEND_TYPE_NULLABLE_BIT,
_ZEND_TYPE_LIST_BIT,
_ZEND_TYPE_UNION_BIT,
_ZEND_TYPE_INTERSECTION_BIT,
zend_type_list,
ts_rsrc_id,
_ZEND_TYPE_NAME_BIT,
_ZEND_TYPE_LITERAL_NAME_BIT,
Expand Down
11 changes: 7 additions & 4 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ impl Install {
}

// Use atomic copy: copy to temp file in same directory, then rename.
// This prevents race conditions where a partially-written extension could be loaded.
// This prevents race conditions where a partially-written extension could be
// loaded.
let temp_ext_path = ext_dir.with_extension(format!(
"{}.tmp.{}",
ext_dir
Expand All @@ -239,15 +240,17 @@ impl Install {
|| "Failed to copy extension from target directory to extension directory",
)?;

// Rename is atomic on POSIX when source and destination are on the same filesystem
// Rename is atomic on POSIX when source and destination are on the same
// filesystem
if let Err(e) = std::fs::rename(&temp_ext_path, &ext_dir) {
// Clean up temp file on failure
let _ = std::fs::remove_file(&temp_ext_path);
return Err(e).with_context(|| "Failed to rename extension to final destination");
}

// Smoke test: verify the extension loads correctly before enabling it in php.ini.
// This prevents broken extensions from crashing PHP on startup.
// Smoke test: verify the extension loads correctly before enabling it in
// php.ini. This prevents broken extensions from crashing PHP on
// startup.
if !self.no_smoke_test {
let smoke_test = Command::new("php")
.arg("-d")
Expand Down
Loading