aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/shirabe-php-shim/src/lib.rs10
-rw-r--r--crates/shirabe/src/installer/binary_installer.rs10
2 files changed, 14 insertions, 6 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs
index 9282795..6acdd0e 100644
--- a/crates/shirabe-php-shim/src/lib.rs
+++ b/crates/shirabe-php-shim/src/lib.rs
@@ -1421,6 +1421,16 @@ pub fn file_get_contents(_path: &str) -> Option<String> {
todo!()
}
+pub fn file_get_contents5(
+ _path: &str,
+ _use_include_path: bool,
+ _context: PhpMixed,
+ _offset: i64,
+ _length: Option<i64>,
+) -> Option<String> {
+ todo!()
+}
+
pub fn strtolower(_s: &str) -> String {
todo!()
}
diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs
index 64908bf..539201f 100644
--- a/crates/shirabe/src/installer/binary_installer.rs
+++ b/crates/shirabe/src/installer/binary_installer.rs
@@ -5,8 +5,8 @@ use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
PhpMixed, basename, basename_with_suffix, chmod, dirname, fclose, fgets, file_exists,
- file_get_contents, file_put_contents, fopen, is_dir, is_file, is_link, realpath, rmdir, substr,
- trim, umask,
+ file_get_contents5, file_put_contents, fopen, is_dir, is_file, is_link, realpath, rmdir,
+ substr, trim, umask,
};
use crate::io::IOInterface;
@@ -245,7 +245,6 @@ impl BinaryInstaller {
self.filesystem
.borrow_mut()
.ensure_directory_exists(&self.bin_dir);
- // TODO(phase-b): PHP assigns realpath(...) even when realpath returns false
self.bin_dir = realpath(&self.bin_dir).unwrap_or_default();
}
@@ -294,9 +293,8 @@ impl BinaryInstaller {
let bin_dir = ProcessExecutor::escape(&dirname(&bin_path));
let bin_file = basename(&bin_path);
- // PHP: file_get_contents($bin, false, null, 0, 500) — limit 500 bytes
- // TODO(phase-b): file_get_contents shim does not support offset/maxlen
- let bin_contents = file_get_contents(bin).unwrap_or_default();
+ let bin_contents =
+ file_get_contents5(bin, false, PhpMixed::Null, 0, Some(500)).unwrap_or_default();
// For php files, we generate a PHP proxy instead of a shell one,
// which allows calling the proxy with a custom php process
if let Some(m) =