Skip to content

Conversation

@Quetzacoalt91
Copy link
Member

Questions Answers
Description? When contents is added before the PHP tag, even an empty space, it is displayed on the webpage. This will however cause some issue if headers must be sent after the display of this contents.
Type? bug fix
BC breaks? Nope
Deprecations? Nope
Fixed ticket? /
How to test? Try an update with PrestaShop/autoupgrade#1504 on a fresh PrestaShop 1.7.7. This error must be fixed:

Example of error triggered during an update:


INFO - 8 modules left to check.
NOTICE - Module welcome update files (6.0.3 => 6.0.9) have been fetched from https://api.addons.prestashop.com/?id_module=22385&method=module&version=1.7.8.11.

ERROR - An error occurred during the update process:
RuntimeException: Failed to start the session because headers have already been sent by "/var/www/html/modules/pagesnotfound/upgrade/pagesnotfound_upgrade_module_2_0_2.php" at line 1. in /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php:150
Stack trace:
#0 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Session.php(57): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
#1 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php(78): Symfony\Component\HttpFoundation\Session\Session->start()
#2 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php(72): Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage->hasToken('ANONYMOUS_USER')
#3 /var/www/html/src/PrestaShopBundle/Service/Routing/Router.php(64): Symfony\Component\Security\Csrf\CsrfTokenManager->getToken('ANONYMOUS_USER')
#4 /var/www/html/modules/welcome/OnBoarding/Configuration.php(99): PrestaShopBundle\Service\Routing\Router->generate('admin_product_n...')
#5 /var/www/html/modules/welcome/OnBoarding/OnBoarding.php(151): OnBoarding\Configuration->getConfiguration(Object(PrestaShopBundle\Service\Routing\Router))
#6 /var/www/html/modules/welcome/OnBoarding/OnBoarding.php(68): OnBoarding\OnBoarding->loadConfiguration(Object(PrestaShopBundle\Service\Routing\Router))
#7 /var/www/html/modules/welcome/welcome.php(89): OnBoarding\OnBoarding->__construct(Object(PrestaShopBundle\Translation\TranslatorComponent), Object(Smarty_Data), Object(Welcome), Object(PrestaShopBundle\Service\Routing\Router))
#8 [internal function]: Welcome->__construct()
#9 /var/www/html/src/Core/Foundation/IoC/Container.php(123): ReflectionClass->newInstance()
#10 /var/www/html/src/Core/Foundation/IoC/Container.php(153): PrestaShop\PrestaShop\Core\Foundation\IoC\Container->makeInstanceFromClassName('welcome', Array)
#11 /var/www/html/src/Core/Foundation/IoC/Container.php(166): PrestaShop\PrestaShop\Core\Foundation\IoC\Container->doMake('welcome', Array)
#12 /var/www/html/src/Adapter/ServiceLocator.php(65): PrestaShop\PrestaShop\Core\Foundation\IoC\Container->make('welcome')
#13 /var/www/html/classes/module/Module.php(1191): PrestaShop\PrestaShop\Adapter\ServiceLocator::get('welcome')
#14 /var/www/html/classes/module/Module.php(1170): ModuleCore::coreLoadModule('welcome')
#15 /var/www/html/modules/autoupgrade/classes/Task/Update/UpdateModules.php(86): ModuleCore::getInstanceByName('welcome')
#16 /var/www/html/modules/autoupgrade/classes/Task/Runner/ChainedTasks.php(66): PrestaShop\Module\AutoUpgrade\Task\Update\UpdateModules->run()
#17 /var/www/html/modules/autoupgrade/classes/Commands/UpdateCommand.php(117): PrestaShop\Module\AutoUpgrade\Task\Runner\ChainedTasks->run()
#18 /var/www/html/modules/autoupgrade/vendor/symfony/console/Command/Command.php(255): PrestaShop\Module\AutoUpgrade\Commands\UpdateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/modules/autoupgrade/vendor/symfony/console/Application.php(992): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/modules/autoupgrade/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(PrestaShop\Module\AutoUpgrade\Commands\UpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/modules/autoupgrade/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/modules/autoupgrade/bin/console(72): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 {main}
In NativeSessionStorage.php line 150:
                                                                               
  Failed to start the session because headers have already been sent by "/var  
  /www/html/modules/pagesnotfound/upgrade/pagesnotfound_upgrade_module_2_0_2.  
  php" at line 1.   

@Hlavtox Hlavtox merged commit 94c4363 into PrestaShop:dev Oct 27, 2025
6 of 7 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Merged in PR Dashboard Oct 27, 2025
@ps-jarvis ps-jarvis moved this from Merged to Ready for review in PR Dashboard Oct 27, 2025
@ps-jarvis
Copy link

PR merged, well done!

Message to @PrestaShop/committers: do not forget to milestone it before the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants