OXIDprojects / oxid-console

OXID Community Console is a php console application for OXID Shop. It provides an API for writing various commands. We have shipped very common for every oxid shop project commands out of the box.
MIT License
7 stars 5 forks source link

PHP Warning: ini_set(): Headers already sent. #31

Closed alfredbez closed 4 years ago

alfredbez commented 4 years ago

There are a few warnings while running vendor/bin/oxid cache:clear. Some developers are confused about this, I think we should fix this:

abez@60538fb8ed55:/var/www/oxideshop$ vendor/bin/oxid cache:clear
Oxid Professional Services consle  is called by vendor/bin/oxid
Oxid project root is found at /var/www/oxideshop
Loading Oxid bootstrap...
PHP Warning:  ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /var/www/oxideshop/source/bootstrap.php on line 205
PHP Stack trace:
PHP   1. {main}() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/bin/oxid:0
PHP   2. OxidProfessionalServices\OxidConsole\Core\Application->run() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/bin/oxid:39
PHP   3. OxidProfessionalServices\OxidConsole\Core\Application->doRun() /var/www/oxideshop/vendor/symfony/console/Application.php:148
PHP   4. OxidProfessionalServices\OxidConsole\Core\Application->loadBootstrap() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/src/Core/Application.php:46
PHP   5. require_once() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/src/Core/Application.php:108
PHP   6. ini_set() /var/www/oxideshop/source/bootstrap.php:205
PHP Warning:  ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /var/www/oxideshop/source/bootstrap.php on line 206
PHP Stack trace:
PHP   1. {main}() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/bin/oxid:0
PHP   2. OxidProfessionalServices\OxidConsole\Core\Application->run() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/bin/oxid:39
PHP   3. OxidProfessionalServices\OxidConsole\Core\Application->doRun() /var/www/oxideshop/vendor/symfony/console/Application.php:148
PHP   4. OxidProfessionalServices\OxidConsole\Core\Application->loadBootstrap() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/src/Core/Application.php:46
PHP   5. require_once() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/src/Core/Application.php:108
PHP   6. ini_set() /var/www/oxideshop/source/bootstrap.php:206
PHP Warning:  ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /var/www/oxideshop/source/bootstrap.php on line 207
PHP Stack trace:
PHP   1. {main}() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/bin/oxid:0
PHP   2. OxidProfessionalServices\OxidConsole\Core\Application->run() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/bin/oxid:39
PHP   3. OxidProfessionalServices\OxidConsole\Core\Application->doRun() /var/www/oxideshop/vendor/symfony/console/Application.php:148
PHP   4. OxidProfessionalServices\OxidConsole\Core\Application->loadBootstrap() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/src/Core/Application.php:46
PHP   5. require_once() /var/www/oxideshop/vendor/oxid-professional-services/oxid-console/src/Core/Application.php:108
PHP   6. ini_set() /var/www/oxideshop/source/bootstrap.php:207
oxid bootstrap done.
collecting comands..
commands collected
commands added
Clearing oxCache...
Clearing smarty cache...
Clearing files cache...
Cache cleared successfully

After manually removing the print statements from src/Core/Application.php and bin/oxid the warnings are gone. Those print statements look a bit hacky to me and I think we can provide a better DX like this:

alfredbez commented 4 years ago

related: https://symfony.com/doc/current/console/verbosity.html

batwolf commented 4 years ago

as a hint, I started seeing these warnings after upgrading from a PHP7.1 build to PHP7.2