[ticket/17176] Ensure helpers are of expected type

PHPBB3-17176
This commit is contained in:
Marc Alexander 2023-08-20 00:14:17 +02:00
parent 0af921d870
commit c91e758902
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 10 additions and 0 deletions

View file

@ -21,6 +21,7 @@ use phpbb\language\language;
use phpbb\passwords\manager; use phpbb\passwords\manager;
use phpbb\user; use phpbb\user;
use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -184,6 +185,10 @@ class add extends command
protected function interact(InputInterface $input, OutputInterface $output) protected function interact(InputInterface $input, OutputInterface $output)
{ {
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
if (!$helper instanceof QuestionHelper)
{
return;
}
$this->data = array( $this->data = array(
'username' => $input->getOption('username'), 'username' => $input->getOption('username'),

View file

@ -19,6 +19,7 @@ use phpbb\log\log_interface;
use phpbb\user; use phpbb\user;
use phpbb\user_loader; use phpbb\user_loader;
use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
@ -151,6 +152,10 @@ class delete extends command
protected function interact(InputInterface $input, OutputInterface $output) protected function interact(InputInterface $input, OutputInterface $output)
{ {
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
if (!$helper instanceof QuestionHelper)
{
return;
}
$question = new ConfirmationQuestion( $question = new ConfirmationQuestion(
$this->language->lang('CLI_USER_DELETE_CONFIRM', $input->getArgument('username')), $this->language->lang('CLI_USER_DELETE_CONFIRM', $input->getArgument('username')),