I have a Symfony command controller in a TYPO3 extension which has arguments. The arguments are set using for example $this->addArgument('myArgument', InputArgument::OPTIONAL, 'My argument', 'default'); and fetched using $input->getArgument('myArgument'). The command is executed using vendor/bin/typo3 myextension:mycommand myargument.
This works fine usually, however one argument is used to set a relative date using strtotime, like -1 week. This causes an error: The "-1" option does not exist. The command used for this is vendor/bin/typo3 myextension:mycommand "-1 week".
Is there a different way to input the argument or a way to escape it? I've already tried "\-1 week"
It's a known bug in Symfony for both arguments and options. I've "fixed" it for now by using
_instead of-and replacing it in my code using$myArgument = preg_replace('/^_/', '-', $input->getArgument('myArgument'));. This does mean my argument can't start with an underscore, but that's not a problem in this case.