From c854041bfca63f39ace6f0c01892e81889f90bb3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 20 Jun 2026 14:24:48 +0900 Subject: fix(global-command): call base_run to stop run() infinite recursion GlobalCommand::run fell back to self.run when given fewer than two args, recursing forever and overflowing the stack. PHP calls parent::run there. Add Command::base_run holding the base run body so the override can delegate to it, matching PHP's parent::run. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/symfony/console/command/command.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/shirabe-external-packages/src/symfony/console/command/command.rs') diff --git a/crates/shirabe-external-packages/src/symfony/console/command/command.rs b/crates/shirabe-external-packages/src/symfony/console/command/command.rs index e737b58..2d94ad2 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/command.rs @@ -393,6 +393,18 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { &mut self, input: Rc>, output: Rc>, + ) -> anyhow::Result { + self.base_run(input, output) + } + + /// The base-class (`Command`) body of `run`, as PHP's `Command::run`. Proxy commands such as + /// `GlobalCommand` override `run` but still call `base_run` to delegate to the base behavior, + /// matching PHP's `parent::run($input, $output)`. It must not be overridden, or the late + /// binding of `initialize`/`interact`/`execute` to the concrete command breaks. + fn base_run( + &mut self, + input: Rc>, + output: Rc>, ) -> anyhow::Result { // add the application arguments and options self.merge_application_definition(true); -- cgit v1.3.1