minor #32736 [Console] avoid using huge amount of memory when formatting long exception (paxal)
minor #32736 [Console] avoid using huge amount of memory when formatting long exception (paxal)

This PR was submitted for the master branch but it was merged into the 4.4 branch instead (closes #32736).

Discussion
----------

[Console] avoid using huge amount of memory when formatting long exception

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none
| License       | MIT

When formatting exceptions, `preg_split('//u')` is used to iterate over utf8 characters. When the exception is long, the amount of memory used is huge and can reach `memory_limit`.

This PR uses a `Generator` to iterate over the string instead of splitting it, thus reducing the amount of memory.

Commits
-------

47ffbad82d Avoid using huge amount of memory when formatting long exception

fabpot/symfony,Taluu/symfony,alekitto/symfony,ragboyjr/symfony,chalasr/symfony,zerkms/symfony,stof/symfony,maidmaid/symfony,curry684/symfony,jvasseur/symfony,localheinz/symfony,kbond/symfony,maidmaid/symfony,mnapoli/symfony,xabbuh/symfony,Taluu/symfony,ragboyjr/symfony,symfony/symfony,voronkovich/symfony,localheinz/symfony,OskarStark/symfony,arjenm/symfony,localheinz/symfony,zerkms/symfony,smatyas/symfony,maidmaid/symfony,nicolas-grekas/symfony,lyrixx/symfony,ragboyjr/symfony,fabpot/symfony,derrabus/symfony,xabbuh/symfony,d-ph/symfony,arjenm/symfony,ogizanagi/symfony,mpdude/symfony,tgalopin/symfony,nicolas-grekas/symfony,1ed/symfony,mnapoli/symfony,pyrech/symfony,smatyas/symfony,docteurklein/symfony,dmaicher/symfony,Tobion/symfony,Deamon/symfony,Nyholm/symfony,jakzal/symfony,mweimerskirch/symfony,nicolas-grekas/symfony,Deamon/symfony,jvasseur/symfony,Nyholm/symfony,sgehrig/symfony,tgalopin/symfony,zorn-v/symfony,xabbuh/symfony,chalasr/symfony,gonzalovilaseca/symfony,yceruto/symfony,stof/symfony,arjenm/symfony,jderusse/symfony,bendavies/symfony,HeahDude/symfony,mnapoli/symfony,zerkms/symfony,Slamdunk/symfony,oleg-andreyev/symfony,tucksaun/symfony,jvasseur/symfony,damienalexandre/symfony,phramz/symfony,garak/symfony,bendavies/symfony,mweimerskirch/symfony,paradajozsef/symfony,dmaicher/symfony,garak/symfony,curry684/symfony,Koc/symfony,yceruto/symfony,lyrixx/symfony,sgehrig/symfony,lstrojny/symfony,MatTheCat/symfony,docteurklein/symfony,paradajozsef/symfony,zcodes/symfony,alekitto/symfony,dmaicher/symfony,oleg-andreyev/symfony,ogizanagi/symfony,OskarStark/symfony,bendavies/symfony,hhamon/symfony,Taluu/symfony,zorn-v/symfony,pierredup/symfony,MatTheCat/symfony,hhamon/symfony,fabpot/symfony,Nyholm/symfony,lstrojny/symfony,derrabus/symfony,symfony/symfony,jderusse/symfony,jakzal/symfony,Simperfit/symfony,kbond/symfony,gonzalovilaseca/symfony,Slamdunk/symfony,nicolas-grekas/symfony,yceruto/symfony,Deamon/symfony,Nyholm/symfony,curry684/symfony,romaricdrigon/symfony,ro0NL/symfony,d-ph/symfony,mpdude/symfony,damienalexandre/symfony,voronkovich/symfony,mnapoli/symfony,pierredup/symfony,stof/symfony,mweimerskirch/symfony,HeahDude/symfony,arjenm/symfony,tucksaun/symfony,ogizanagi/symfony,Deamon/symfony,HeahDude/symfony,1ed/symfony,mnapoli/symfony,MatTheCat/symfony,oleg-andreyev/symfony,Simperfit/symfony,chalasr/symfony,jvasseur/symfony,localheinz/symfony,smatyas/symfony,tgalopin/symfony,yceruto/symfony,shieldo/symfony,symfony/symfony,ro0NL/symfony,zorn-v/symfony,bendavies/symfony,1ed/symfony,Simperfit/symfony,damienalexandre/symfony,hhamon/symfony,mweimerskirch/symfony,ro0NL/symfony,derrabus/symfony,pyrech/symfony,zerkms/symfony,alekitto/symfony,shieldo/symfony,paradajozsef/symfony,pierredup/symfony,lyrixx/symfony,jderusse/symfony,jakzal/symfony,phramz/symfony,d-ph/symfony,docteurklein/symfony,kbond/symfony,sgehrig/symfony,chalasr/symfony,garak/symfony,HeahDude/symfony,hhamon/symfony,pyrech/symfony,smatyas/symfony,Tobion/symfony,Tobion/symfony,fabpot/symfony,derrabus/symfony,lstrojny/symfony,d-ph/symfony,mpdude/symfony,sgehrig/symfony,zcodes/symfony,Koc/symfony,tucksaun/symfony,phramz/symfony,shieldo/symfony,lyrixx/symfony,MatTheCat/symfony,Koc/symfony,mpdude/symfony,tgalopin/symfony,pyrech/symfony,shieldo/symfony,stof/symfony,maidmaid/symfony,dmaicher/symfony,OskarStark/symfony,voronkovich/symfony,garak/symfony,xabbuh/symfony,gonzalovilaseca/symfony,paradajozsef/symfony,tucksaun/symfony,zcodes/symfony,Koc/symfony,jderusse/symfony,Taluu/symfony,smatyas/symfony,romaricdrigon/symfony,gonzalovilaseca/symfony,jakzal/symfony,docteurklein/symfony,Slamdunk/symfony,symfony/symfony,Simperfit/symfony,kbond/symfony,oleg-andreyev/symfony,zcodes/symfony,ragboyjr/symfony,mweimerskirch/symfony,pierredup/symfony,Slamdunk/symfony,romaricdrigon/symfony,ro0NL/symfony,OskarStark/symfony,phramz/symfony,voronkovich/symfony,docteurklein/symfony,alekitto/symfony,Simperfit/symfony,ogizanagi/symfony,curry684/symfony,Deamon/symfony,1ed/symfony,damienalexandre/symfony,zorn-v/symfony,romaricdrigon/symfony,Tobion/symfony