Skip to content

Symfony console breaks on certain terminal width when displaying an exception #22021

@mjrider

Description

@mjrider
Q A
Bug report? yes
Feature request? no
BC Break report? ?
RFC? no
Symfony version v3.2.6

When displaying an exception, symfony console produces the following error
The example breaks on my machine when my terminal is between 72 and 134 columns
Repository with a minimal reproduction is available on: https://github.com/mjrider/break-symfony-console

PHP Fatal error:  Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in /tmp/example-minimum/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php:87
Stack trace:
#0 /tmp/example-minimum/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatter.php(185): Symfony\Component\Console\Formatter\OutputFormatterStyleStack->pop(Object(Symfony\Component\Console\Formatter\OutputFormatterStyle))
#1 /tmp/example-minimum/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(653): Symfony\Component\Console\Formatter\OutputFormatter->format('<error>   => '1...')
#2 /tmp/example-minimum/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(Exception), Object(Symfony\Component\Console\Output\StreamOutput))
#3 /tmp/example-minimum/test.php(17): Symfony\Component\Console\Application->run()
#4 {main}
  thrown in /tmp/example-minimum/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php on line 87

OS information: Linux Mint 18.1

$ php -v
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies
php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
ssh2
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions