diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-24 21:07:26 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-24 21:07:26 +0900 |
| commit | 20f9787cda5b846c730cff97a4c7a3777ff3414a (patch) | |
| tree | 2110607ee9842fa5288665bba56b03020057f432 /crates/shirabe/src/util/platform.rs | |
| parent | 8cf8c04ab9b5a1f5bc7a8eb3230698f07fb7c204 (diff) | |
| download | php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.tar.gz php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.tar.zst php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.zip | |
refactor(silencer): stop guarding work that stays inside Rust
Silencer only lowers the PHP error_reporting() level and re-throws
whatever the guarded work raises. A region that never reaches the PHP
runtime has no level to lower and emits no diagnostic on failure, so
wrapping it is indistinguishable from running it unguarded.
The pair kept in Application::hint_common_errors brackets a
getComposer() call, which loads installed plugins and dispatches
PluginEvents::INIT.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/platform.rs')
| -rw-r--r-- | crates/shirabe/src/util/platform.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs index bb3dd739..3a95af7e 100644 --- a/crates/shirabe/src/util/platform.rs +++ b/crates/shirabe/src/util/platform.rs @@ -1,7 +1,6 @@ //! ref: composer/src/Composer/Util/Platform.php use crate::util::ProcessExecutor; -use crate::util::Silencer; use shirabe_php_shim::{ PHP_ENV, PHP_SERVER, PhpMixed, PhpResource, PregMatches, RuntimeException, defined, file_exists, file_get_contents, function_exists, getcwd, getenv, ini_get, is_readable, @@ -164,10 +163,7 @@ impl Platform { return false; } - let file_contents = Silencer::call(|| Ok(file_get_contents("/proc/version").ok())) - .ok() - .flatten() - .unwrap_or_default(); + let file_contents = file_get_contents("/proc/version").unwrap_or_default(); if !ini_get("open_basedir").is_some_and(|s| PhpMixed::String(s).to_bool()) && is_readable("/proc/version") // TODO(bytes) @@ -220,11 +216,7 @@ impl Platform { } // suppress errors as some environments have these files as readable but system restrictions prevent the read from succeeding // see https://github.com/composer/composer/issues/12095 - let data = match Silencer::call(|| Ok(file_get_contents(cgroup))) { - Ok(d) => d, - Err(_) => break, - }; - let data = match data { + let data = match file_get_contents(cgroup) { Ok(d) => d, Err(_) => continue, }; |
