bug #19510 [Process] Fix double-fread() when reading unix pipes (nicolas-grekas)
bug #19510 [Process] Fix double-fread() when reading unix pipes (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Process] Fix double-fread() when reading unix pipes

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

While looking at the blackfire profile of a `composer install`, I was able to reduce the number of calls to `fread` from 90k to 60k using this patch (and from 60k to <1k with https://github.com/composer/composer/pull/5569 but that's another story).

In fact, we should continue reading only if there might be something next, which won"t be the case if the buffer has not been filled.

Commits
-------

ac17617 [Process] Fix double-fread() when reading unix pipes

shieldo/symfony,yceruto/symfony,pyrech/symfony,unexge/symfony,apfelbox/symfony,Deamon/symfony,tgalopin/symfony,romainneutron/symfony,unexge/symfony,gonzalovilaseca/symfony,chrisguitarguy/symfony,nasimnabavi/symfony,mickaelandrieu/symfony,dosten/symfony,fabpot/symfony,symfony/symfony,klandaika/symfony,arjenm/symfony,hason/symfony,lstrojny/symfony,neemzy/symfony,bendavies/symfony,mihai-stancu/symfony,alekitto/symfony,WhiteEagle88/symfony,jakubsacha/symfony,Soullivaneuh/symfony,sroze/symfony,romainneutron/symfony,andreia/symfony,sstok/symfony,WhiteEagle88/symfony,GuilhemN/symfony,jjanvier/symfony,hiddewie/symfony,ro0NL/symfony,sgehrig/symfony,d-ph/symfony,d-ph/symfony,d-ph/symfony,MatTheCat/symfony,zerustech/symfony,unexge/symfony,jvasseur/symfony,michaelperrin/symfony,lyrixx/symfony,fabpot/symfony,josephdpurcell/symfony,voronkovich/symfony,jakubsacha/symfony,Aliance/symfony,derrabus/symfony,andreia/symfony,jvasseur/symfony,dunglas/symfony,Pierstoval/symfony,ragboyjr/symfony,joelwurtz/symfony,mickaelandrieu/symfony,maidmaid/symfony,Simperfit/symfony,Nyholm/symfony,Pierstoval/symfony,bendavies/symfony,sstok/symfony,frankdejonge/symfony,zerkms/symfony,andrerom/symfony,hiddewie/symfony,iltar/symfony,e-moe/symfony,curry684/symfony,hason/symfony,chalasr/symfony,pamil/symfony,dmaicher/symfony,dmaicher/symfony,Soullivaneuh/symfony,smatyas/symfony,dosten/symfony,GuilhemN/symfony,Strate/symfony,damienalexandre/symfony,fabpot/symfony,zerkms/symfony,ajgarlag/symfony,Simperfit/symfony,jakzal/symfony,ragboyjr/symfony,ogizanagi/symfony,mvhirsch/symfony,SpacePossum/symfony,romainneutron/symfony,mnapoli/symfony,Ener-Getick/symfony,gonzalovilaseca/symfony,xabbuh/symfony,oleg-andreyev/symfony,Einenlum/symfony,neemzy/symfony,arjenm/symfony,Koc/symfony,Tobion/symfony,hason/symfony,gimler/symfony,jameshalsall/symfony,sgehrig/symfony,iltar/symfony,lstrojny/symfony,mnapoli/symfony,c960657/symfony,c960657/symfony,WouterJ/symfony,dosten/symfony,zorn-v/symfony,paradajozsef/symfony,romainneutron/symfony,lemoinem/symfony,jean-gui/symfony,gnat42/symfony,Amo/symfony,Nyholm/symfony,jjanvier/symfony,nasimnabavi/symfony,chalasr/symfony,derrabus/symfony,patrick-mcdougle/symfony,SpacePossum/symfony,SaschaDens/symfony,hhamon/symfony,Taluu/symfony,gonzalovilaseca/symfony,dunglas/symfony,jjanvier/symfony,WouterJ/symfony,localheinz/symfony,mpdude/symfony,Soullivaneuh/symfony,inso/symfony,OskarStark/symfony,maidmaid/symfony,sroze/symfony,frankdejonge/symfony,joelwurtz/symfony,docteurklein/symfony,Tobion/symfony,Triiistan/symfony,shieldo/symfony,fabpot/symfony,zcodes/symfony,vincentaubert/symfony,mpdude/symfony,MatTheCat/symfony,stof/symfony,klandaika/symfony,OndraM/symfony,klandaika/symfony,aeoris/symfony,pierredup/symfony,Simperfit/symfony,codeclimate-testing/symfony,Ener-Getick/symfony,c960657/symfony,OskarStark/symfony,mnapoli/symfony,zorn-v/symfony,romaricdrigon/symfony,zerustech/symfony,SpacePossum/symfony,jameshalsall/symfony,dzuelke/symfony,gimler/symfony,jakzal/symfony,jderusse/symfony,zorn-v/symfony,dzuelke/symfony,Taluu/symfony,derrabus/symfony,DavidGarciaCat/symfony,hiddewie/symfony,jvasseur/symfony,Deamon/symfony,csarrazi/symfony,OndraM/symfony,sroze/symfony,maidmaid/symfony,OndraM/symfony,nasimnabavi/symfony,Pierstoval/symfony,xabbuh/symfony,jakzal/symfony,Aliance/symfony,hacfi/symfony,zerkms/symfony,Einenlum/symfony,curry684/symfony,ro0NL/symfony,symfony/symfony,SaschaDens/symfony,ajgarlag/symfony,Tobion/symfony,frankdejonge/symfony,dmaicher/symfony,patrick-mcdougle/symfony,lepiaf/symfony,OndraM/symfony,codeclimate-testing/symfony,zcodes/symfony,codeclimate-testing/symfony,andreia/symfony,klandaika/symfony,gimler/symfony,Amo/symfony,shieldo/symfony,teohhanhui/symfony,paradajozsef/symfony,Padam87/symfony,chrisguitarguy/symfony,havvg/symfony,nicolas-grekas/symfony,k0pernikus/symfony,romaricdrigon/symfony,Padam87/symfony,frankdejonge/symfony,xabbuh/symfony,sgehrig/symfony,Padam87/symfony,backbone87/symfony,localheinz/symfony,HeahDude/symfony,apetitpa/symfony,zerustech/symfony,mnapoli/symfony,apetitpa/symfony,havvg/symfony,dmaicher/symfony,pierredup/symfony,oleg-andreyev/symfony,arjenm/symfony,andrerom/symfony,romaricdrigon/symfony,chalasr/symfony,ajgarlag/symfony,Amo/symfony,apetitpa/symfony,localheinz/symfony,Triiistan/symfony,mvhirsch/symfony,e-moe/symfony,alekitto/symfony,mvhirsch/symfony,pamil/symfony,k0pernikus/symfony,Ener-Getick/symfony,Slamdunk/symfony,jean-gui/symfony,Amo/symfony,hacfi/symfony,Engerim/symfony,aeoris/symfony,vincentaubert/symfony,nicolas-grekas/symfony,alekitto/symfony,mweimerskirch/symfony,maidmaid/symfony,smatyas/symfony,derrabus/symfony,kbond/symfony,SaschaDens/symfony,Einenlum/symfony,havvg/symfony,yceruto/symfony,yceruto/symfony,Triiistan/symfony,HeahDude/symfony,Triiistan/symfony,d-ph/symfony,garak/symfony,SpacePossum/symfony,michaelperrin/symfony,localheinz/symfony,andrerom/symfony,dzuelke/symfony,OskarStark/symfony,phramz/symfony,lepiaf/symfony,mnapoli/symfony,e-moe/symfony,kbond/symfony,hhamon/symfony,aeoris/symfony,k0pernikus/symfony,deguif/symfony,dunglas/symfony,Koc/symfony,joelwurtz/symfony,sgehrig/symfony,hacfi/symfony,voronkovich/symfony,lemoinem/symfony,pierredup/symfony,tucksaun/symfony,jzawadzki/symfony,lepiaf/symfony,GuilhemN/symfony,jderusse/symfony,sstok/symfony,Taluu/symfony,lyrixx/symfony,Ener-Getick/symfony,teohhanhui/symfony,dosten/symfony,ragboyjr/symfony,weaverryan/symfony,andreia/symfony,tucksaun/symfony,zcodes/symfony,mihai-stancu/symfony,Amo/symfony,alekitto/symfony,kbond/symfony,e-moe/symfony,garak/symfony,joelwurtz/symfony,okdana/symfony,dzuelke/symfony,weaverryan/symfony,Taluu/symfony,okdana/symfony,curry684/symfony,SpacePossum/symfony,stof/symfony,jakubsacha/symfony,apfelbox/symfony,Pierstoval/symfony,andrerom/symfony,mihai-stancu/symfony,zerkms/symfony,GuilhemN/symfony,ogizanagi/symfony,Strate/symfony,Einenlum/symfony,pyrech/symfony,jakubsacha/symfony,docteurklein/symfony,lemoinem/symfony,hiddewie/symfony,Koc/symfony,dbu/symfony,jjanvier/symfony,ajgarlag/symfony,vincentaubert/symfony,apfelbox/symfony,chrisguitarguy/symfony,zorn-v/symfony,GuilhemN/symfony,Engerim/symfony,garak/symfony,smatyas/symfony,nasimnabavi/symfony,symfony/symfony,oleg-andreyev/symfony,DavidGarciaCat/symfony,tgalopin/symfony,ogizanagi/symfony,Padam87/symfony,gencer/symfony,damienalexandre/symfony,patrick-mcdougle/symfony,zcodes/symfony,gimler/symfony,mihai-stancu/symfony,mpdude/symfony,voronkovich/symfony,SaschaDens/symfony,MatTheCat/symfony,deguif/symfony,paradajozsef/symfony,weaverryan/symfony,inso/symfony,jameshalsall/symfony,smatyas/symfony,jjanvier/symfony,docteurklein/symfony,mihai-stancu/symfony,MatTheCat/symfony,phramz/symfony,OndraM/symfony,klandaika/symfony,Aliance/symfony,jameshalsall/symfony,lemoinem/symfony,havvg/symfony,tucksaun/symfony,phramz/symfony,nicolas-grekas/symfony,Tobion/symfony,jean-gui/symfony,gencer/symfony,jderusse/symfony,SaschaDens/symfony,backbone87/symfony,jameshalsall/symfony,jzawadzki/symfony,codeclimate-testing/symfony,xabbuh/symfony,dbu/symfony,inso/symfony,k0pernikus/symfony,apfelbox/symfony,Strate/symfony,Koc/symfony,vincentaubert/symfony,Triiistan/symfony,sstok/symfony,jderusse/symfony,mweimerskirch/symfony,nicolas-grekas/symfony,jakzal/symfony,havvg/symfony,josephdpurcell/symfony,kbond/symfony,dzuelke/symfony,OskarStark/symfony,paradajozsef/symfony,mweimerskirch/symfony,sroze/symfony,yceruto/symfony,symfony/symfony,michaelperrin/symfony,michaelperrin/symfony,hiddewie/symfony,shieldo/symfony,garak/symfony,Simperfit/symfony,mickaelandrieu/symfony,iltar/symfony,unexge/symfony,inso/symfony,smatyas/symfony,okdana/symfony,Deamon/symfony,c960657/symfony,csarrazi/symfony,ro0NL/symfony,jean-gui/symfony,pyrech/symfony,docteurklein/symfony,josephdpurcell/symfony,mpdude/symfony,docteurklein/symfony,gonzalovilaseca/symfony,chrisguitarguy/symfony,csarrazi/symfony,tucksaun/symfony,oleg-andreyev/symfony,mvhirsch/symfony,teohhanhui/symfony,jzawadzki/symfony,lstrojny/symfony,teohhanhui/symfony,bendavies/symfony,dbu/symfony,unexge/symfony,hhamon/symfony,mweimerskirch/symfony,curry684/symfony,ragboyjr/symfony,inso/symfony,1ed/symfony,dosten/symfony,1ed/symfony,Nyholm/symfony,neemzy/symfony,stof/symfony,lyrixx/symfony,chrisguitarguy/symfony,pamil/symfony,mickaelandrieu/symfony,Nyholm/symfony,pierredup/symfony,Soullivaneuh/symfony,arjenm/symfony,bendavies/symfony,ogizanagi/symfony,tgalopin/symfony,Engerim/symfony,WhiteEagle88/symfony,zerustech/symfony,apfelbox/symfony,Deamon/symfony,HeahDude/symfony,zerustech/symfony,gnat42/symfony,stof/symfony,DavidGarciaCat/symfony,Padam87/symfony,1ed/symfony,Ener-Getick/symfony,dbu/symfony,lyrixx/symfony,mvhirsch/symfony,pyrech/symfony,damienalexandre/symfony,jvasseur/symfony,deguif/symfony,damienalexandre/symfony,phramz/symfony,gnat42/symfony,mweimerskirch/symfony,ro0NL/symfony,backbone87/symfony,k0pernikus/symfony,tgalopin/symfony,Slamdunk/symfony,iltar/symfony,lemoinem/symfony,chalasr/symfony,patrick-mcdougle/symfony,patrick-mcdougle/symfony,Ener-Getick/symfony,Soullivaneuh/symfony,hhamon/symfony,pamil/symfony,gencer/symfony,HeahDude/symfony,romaricdrigon/symfony,Slamdunk/symfony,jakubsacha/symfony,apetitpa/symfony,voronkovich/symfony,weaverryan/symfony,WouterJ/symfony,gnat42/symfony,deguif/symfony,Simperfit/symfony,dbu/symfony,mickaelandrieu/symfony,romainneutron/symfony,sstok/symfony,Deamon/symfony,Slamdunk/symfony,1ed/symfony