From 9a6881276a6aeb4d3b49046045f6e26303cc6e52 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 04:00:20 +0900 Subject: fix(symfony-filesystem): restore upstream behavior in five spots Port the Symfony Filesystem branches this file had left out: * copy() preserves the origin mtime via touch() * exists() rejects paths longer than PHP_MAXPATHLEN - 2, so its return type becomes anyhow::Result * doRemove()'s symlink branch keeps the DIRECTORY_SEPARATOR disjunct, which stops it from throwing on Unix where upstream never does * symlink() normalizes separators and mirrors instead of linking when copyOnWindows is set * mirror() skips entries whose real path is the target directory or was already created earlier in the same call PHP_MAXPATHLEN is new in shirabe-php-shim. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-shim/src/fs.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/shirabe-php-shim/src/fs.rs') diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs index 9303ad21..ac7a4f99 100644 --- a/crates/shirabe-php-shim/src/fs.rs +++ b/crates/shirabe-php-shim/src/fs.rs @@ -22,6 +22,15 @@ pub const PATHINFO_BASENAME: i64 = 2; pub const PATH_SEPARATOR: &str = ":"; pub const DIRECTORY_SEPARATOR: &str = "/"; +/// PHP `PHP_MAXPATHLEN`: the platform's `MAXPATHLEN` (`MAX_PATH` on Windows). +pub const PHP_MAXPATHLEN: i64 = if cfg!(windows) { + 260 +} else if cfg!(target_os = "linux") { + 4096 +} else { + 1024 +}; + pub const FILE_IGNORE_NEW_LINES: i64 = 2; pub const SEEK_SET: i64 = 0; -- cgit v1.3.1