Surf icon indicating copy to clipboard operation
Surf copied to clipboard

symfony/console exception "Incorrectly nested style tag found."

Open jonaseberle opened this issue 4 years ago • 3 comments

Expected Behavior

If a Surf command produces output, it should be shown on the console.

Sidenote: The conditions for Surf to show output are as far as I know:

Either of

  • command exits unsuccessful
  • command outputs something to stderr
  • surf is run with -v

Actual Behavior

If the output contains style tags or parts of it symfony/console tries to interpret them and might throw a \Symfony\Component\Console\Exception\InvalidArgumentException('Incorrectly nested style tag found.').

That exception triggers a depoyment rollback.

Steps to Reproduce the Problem

The actual use case was displaying some HTML in a smoke test.

This simple task reproduces what happened:

$deployment->getWorkflow()
  ->defineTask(
      'TestSymfonyTask',
      LocalShellTask::class,
      [
          'command' => [
              'echo "123</info>"',
          ],
      ]
  )

Specifications

  • Surf Version: 2.3.2
  • Application:
  • PHP Version: 7.4
  • Platform: Linux
  • Environment (CI): ddev
  • Deployment configuration:

jonaseberle avatar Oct 20 '21 12:10 jonaseberle

What is the expected behavior? <info> is a console style command.

simonschaufi avatar Oct 20 '21 13:10 simonschaufi

It should output the command output unchanged since there might just be these style tags in between some output but you don't want them to be interpreted in any way.

It has the potential to break if it gets fed arbitrary output.

jonaseberle avatar Oct 20 '21 14:10 jonaseberle

I will take care of it in the next couple of weeks because i have some deadlines coming up which are more important for me right now - or you fix it yourself ;)

simonschaufi avatar Oct 21 '21 12:10 simonschaufi

I am going to close this issue due to inactivity. Just by reading i would guess this has nothing to do with Surf but with Symfony Console.

sabbelasichon avatar May 25 '23 21:05 sabbelasichon

It's not a biggy but IMHO the output of commands should be escaped if the output interpretes these tags.

jonaseberle avatar May 26 '23 08:05 jonaseberle