aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/remote_filesystem.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 17:42:32 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 17:42:32 +0900
commitf05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b (patch)
treeb93311ab2473b988051f0285efb7181afe301fe5 /crates/shirabe/src/util/remote_filesystem.rs
parent277dc4065d2eb0d6621a6aa56a299a0d2369caf7 (diff)
downloadphp-shirabe-f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b.tar.gz
php-shirabe-f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b.tar.zst
php-shirabe-f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b.zip
refactor(php-shim): split filter_var into per-filter functions
Replace the dispatch-on-constant filter_var() and filter_var_with_options() with dedicated filter_var_boolean/url/email/ip and filter_var_int_with_range, dropping the FILTER_VALIDATE_* constants and updating all call sites. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/remote_filesystem.rs')
-rw-r--r--crates/shirabe/src/util/remote_filesystem.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs
index bada2af..e36a174 100644
--- a/crates/shirabe/src/util/remote_filesystem.rs
+++ b/crates/shirabe/src/util/remote_filesystem.rs
@@ -4,12 +4,12 @@ use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- FILTER_VALIDATE_BOOLEAN, PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PHP_VERSION_ID, PhpMixed,
- RuntimeException, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS,
+ PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PHP_VERSION_ID, PhpMixed, RuntimeException,
+ STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS,
array_replace_recursive, base64_encode, explode, extension_loaded, file_put_contents,
- filter_var, gethostbyname, http_clear_last_response_headers, http_get_last_response_headers,
- ini_get, json_decode, parse_url, preg_quote, sprintf, strpos, strtolower, strtr, substr, trim,
- zlib_decode,
+ filter_var_boolean, gethostbyname, http_clear_last_response_headers,
+ http_get_last_response_headers, ini_get, json_decode, parse_url, preg_quote, sprintf, strpos,
+ strtolower, strtr, substr, trim, zlib_decode,
};
use crate::config::Config;
@@ -410,10 +410,7 @@ impl RemoteFilesystem {
result = None;
}
if !error_message.is_empty()
- && !filter_var(
- &ini_get("allow_url_fopen").unwrap_or_default(),
- FILTER_VALIDATE_BOOLEAN,
- )
+ && !filter_var_boolean(&ini_get("allow_url_fopen").unwrap_or_default())
{
error_message = format!(
"allow_url_fopen must be enabled in php.ini ({})",