diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-09 07:19:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-09 07:19:49 +0900 |
| commit | ae19de8597f41c83983e6e6ca35f31d845f16bd3 (patch) | |
| tree | c9050af966b680dc9ddda3dbb3fa8180fbae6e4a /crates/shirabe-php-shim/src/runtime.rs | |
| parent | 6b83e68d7961f150ec15dd59d457d519e0bf8663 (diff) | |
| download | php-shirabe-ae19de8597f41c83983e6e6ca35f31d845f16bd3.tar.gz php-shirabe-ae19de8597f41c83983e6e6ca35f31d845f16bd3.tar.zst php-shirabe-ae19de8597f41c83983e6e6ca35f31d845f16bd3.zip | |
feat(archiver): preserve file permissions in zip archives
The shim reported setExternalAttributesName as missing, so ZipArchiver took
the branch for libzip below 0.11.2 and every archived entry got the zip
crate's default mode. The attributes now travel as arguments to add_file and
add_empty_dir, because the crate fixes an entry's external attributes when
the entry is started and offers no way to amend one already written.
unix_permissions keeps only the low 9 mode bits, on top of which the crate
restores S_IFREG and S_IFDIR, so setuid/setgid/sticky bits and other file
types are still dropped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src/runtime.rs')
| -rw-r--r-- | crates/shirabe-php-shim/src/runtime.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs index c00c8f51..13513b9d 100644 --- a/crates/shirabe-php-shim/src/runtime.rs +++ b/crates/shirabe-php-shim/src/runtime.rs @@ -77,14 +77,9 @@ pub fn defined(name: &str) -> bool { // `Composer\Autoload\ClassLoader` (and its `getRegisteredLoaders`) is absent from the running // process; the class-name form therefore reports no such method. The object form needs runtime // reflection that PhpMixed::Object does not carry. -pub fn method_exists(object_or_class: &PhpMixed, method_name: &str) -> bool { +pub fn method_exists(object_or_class: &PhpMixed, _method_name: &str) -> bool { match object_or_class { PhpMixed::String(_) => false, - // `ZipArchiver::archive` guards `$zip->setExternalAttributesName(...)` with - // `method_exists($zip, 'setExternalAttributesName')` (only available with libzip >= 0.11.2). - // The `zip`-crate-backed shim cannot amend an already-written entry's external attributes, - // so the method is deliberately absent here and the guard reports it missing. - PhpMixed::Null if method_name == "setExternalAttributesName" => false, _ => todo!(), } } |
