aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/console/command/command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 14:24:48 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 14:24:48 +0900
commitc854041bfca63f39ace6f0c01892e81889f90bb3 (patch)
tree0273d6bed22c0009ea026f927b46805eb8ac0e47 /crates/shirabe-external-packages/src/symfony/console/command/command.rs
parente77a37c5447a4d122629ef8fbc9bef309668aa89 (diff)
downloadphp-shirabe-c854041bfca63f39ace6f0c01892e81889f90bb3.tar.gz
php-shirabe-c854041bfca63f39ace6f0c01892e81889f90bb3.tar.zst
php-shirabe-c854041bfca63f39ace6f0c01892e81889f90bb3.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/command/command.rs')
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/command.rs12
1 files changed, 12 insertions, 0 deletions
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
@@ -394,6 +394,18 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny {
input: Rc<RefCell<dyn InputInterface>>,
output: Rc<RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
+ 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<RefCell<dyn InputInterface>>,
+ output: Rc<RefCell<dyn OutputInterface>>,
+ ) -> anyhow::Result<i64> {
// add the application arguments and options
self.merge_application_definition(true);