aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src/fs.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-25 16:27:53 +0900
committernsfisis <nsfisis@gmail.com>2026-06-26 00:20:05 +0900
commit3a0d9340810a8808d963135a884f50d08442ac67 (patch)
tree9fbed3350a23c791f52e37209095e0db41962c87 /crates/shirabe-php-shim/src/fs.rs
parent46ac7242d526e13707dc140b7244e0fadf2219b9 (diff)
downloadphp-shirabe-3a0d9340810a8808d963135a884f50d08442ac67.tar.gz
php-shirabe-3a0d9340810a8808d963135a884f50d08442ac67.tar.zst
php-shirabe-3a0d9340810a8808d963135a884f50d08442ac67.zip
test: port 59 autoload/vcs/installer/util/command tests; fix output capture
Port autoload_generator (24), bitbucket (14), suggested_packages (11), git_driver (6), archive_manager (3), and a bump command test. Fix the ApplicationTester output-capture root cause (php://memory streams must be readable regardless of fopen mode). Implement posix_getuid/geteuid, the PCRE 'A' anchored modifier, php_strip_whitespace, stream_get_wrappers, is_callable scalars; fix preg_quote angle-bracket escaping and class-map parser regexes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src/fs.rs')
-rw-r--r--crates/shirabe-php-shim/src/fs.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs
index ee2bbee..5558f58 100644
--- a/crates/shirabe-php-shim/src/fs.rs
+++ b/crates/shirabe-php-shim/src/fs.rs
@@ -254,12 +254,15 @@ pub fn fopen(file: &str, mode: &str) -> Result<PhpResource, std::io::Error> {
"w" | "a" | "x" | "c" => (false, true),
_ => (true, true), // r+, w+, a+, x+, c+, rw, ...
};
- // php://memory and php://temp are in-memory streams.
+ // php://memory and php://temp are in-memory streams. PHP's memory wrapper ignores the read /
+ // write restrictions implied by the mode: a memory stream opened with "w" is still readable
+ // (this is what Symfony's ApplicationTester relies on -- it opens "php://memory" with "w" and
+ // then rewinds + reads it back). So memory streams are always both readable and writable.
if file == "php://memory" || file.starts_with("php://temp") {
return Ok(StreamState::new(
StreamBacking::Memory(std::io::Cursor::new(Vec::new())),
- readable,
- writable,
+ true,
+ true,
mode.to_string(),
file.to_string(),
));