aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/ini_helper.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-10 00:57:19 +0900
committernsfisis <nsfisis@gmail.com>2026-08-10 02:35:55 +0900
commitbbf33b836026cbe9fb9e7c76291dcb133b7144e2 (patch)
tree8b0437c321467bb8151cacb17c2414874f342443 /crates/shirabe/src/util/ini_helper.rs
parent177edc22cac6475db85cba9e0d19e6440aef64bb (diff)
downloadphp-shirabe-bbf33b836026cbe9fb9e7c76291dcb133b7144e2.tar.gz
php-shirabe-bbf33b836026cbe9fb9e7c76291dcb133b7144e2.tar.zst
php-shirabe-bbf33b836026cbe9fb9e7c76291dcb133b7144e2.zip
feat(xdebug): switch Xdebug off in the PHP worker
Composer restarts itself with Xdebug unloaded because Xdebug makes PHP several times slower. Xdebug is never loaded into this process, so what needs dealing with is the PHP worker: it is spawned with `-d xdebug.mode=off` and `XDEBUG_MODE=off` (Xdebug reads the environment variable first and lets it override every ini setting), which makes its module init return before it installs any executor, compile, error or opcode hook. Rewriting the ini files and re-executing, the way xdebug-handler does, would additionally cover Xdebug 2, which hooks unconditionally and has no equivalent setting. That is not worth its machinery here: Xdebug 2 caps out at PHP 7.4, while every PHP version Composer supports can run Xdebug 3. What remains of XdebugHandler is small enough to live beside the worker it governs, so its crate is gone and its callers inline it. isXdebugActive answers false without asking PHP whenever the worker is switched off, so a command that needs no PHP does not spawn one just for the Xdebug warning; diagnose reports what the worker measures instead, which still surfaces an Xdebug that ignores the setting. PlatformRepository has no unloaded extension to restore, since switching the mode off leaves it loaded. COMPOSER_ORIGINAL_INIS is neither written nor read: it exists so a restarted process can name the ini files it replaced, and IniHelper can report the worker's own. IniHelperTest injects through that variable, so none of its cases are ported. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/ini_helper.rs')
-rw-r--r--crates/shirabe/src/util/ini_helper.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/shirabe/src/util/ini_helper.rs b/crates/shirabe/src/util/ini_helper.rs
index 4ff9a5e2..08f5c816 100644
--- a/crates/shirabe/src/util/ini_helper.rs
+++ b/crates/shirabe/src/util/ini_helper.rs
@@ -4,10 +4,12 @@ pub struct IniHelper;
impl IniHelper {
/// Returns an array of php.ini locations with at least one entry.
+ ///
+ /// PHP asks `XdebugHandler::getAllIniFiles()`, which answers from `COMPOSER_ORIGINAL_INIS`
+ /// when it is set, because a restarted process runs on a generated ini file and has to name
+ /// the ones it replaced. Nothing here restarts PHP, so the worker always runs on the machine's
+ /// own ini files and the variable is not consulted.
pub fn get_all() -> Vec<String> {
- // PHP: XdebugHandler::getAllIniFiles(). shirabe_xdebug_handler::XdebugHandler's port
- // of that method is a stub that returns the PHP default, so query the real PHP
- // runtime's loaded/scanned ini files here instead.
shirabe_php_rpc::get_all_ini_files()
}