Good morning,
After developing and testing a project locally, I installed it on the production server.
But there, as soon as the application has to write in session, I get an error message:
Cake\Http\Session::_overwrite(): Argument #1 ($old) must be of type array, null given, called in /home/clients/…/vendor/cakephp/cakephp/src/Http/Session.php on line 513
Even flash component throws the error when it needs to write to the session.
I’ve looked for solutions on various forums, but so far nothing conclusive.
The best track I had was an output_buffering active locally and not in prod, but for my part it is deactivated by default locally.
My version of Cakephp is 4.2.12. The prod php is 8.1 as in local.
Here is one of the functions present in a Utility file which generates this error:
public function cookiesConsent() {
$session = Router::getRequest()->getSession();
$session->write([
'Config.cookies_consent' => 'oui',
]);
}
I also have notifications, but I don’t know if they really affect this problem.
Deprecated (8192): Return type of Cake\Database\Query::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [CORE/src/Database/Query.php, line 1908]
Deprecated (8192): Return type of Cake\Database\Statement\StatementDecorator::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [CORE/src/Database/Statement/StatementDecorator.php, line 285]
Deprecated (8192): Return type of Cake\ORM\ResultSet::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [CORE/src/ORM/ResultSet.php, line 187]
Deprecated (8192): Cake\ORM\ResultSet implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) [CORE/src/ORM/ResultSet.php, line 33]
Deprecated (8192): Cake\Collection\Collection implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) [CORE/src/Collection/Collection.php, line 27]
Deprecated (8192): Cake\Collection\Iterator\FilterIterator implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) [CORE/src/Collection/Iterator/FilterIterator.php, line 31]
Deprecated (8192): Return type of & Cake\ORM\Entity::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [CORE/src/Datasource/EntityTrait.php, line 604]
Warning (512): Unable to emit headers. Headers sent in file=/home/clients/8bab20da221b641bfd7b7ea783842e6e/sites/jeu-noel-grandlitier.fr/vendor/cakephp/cakephp/src/Error/Debugger.php line=971 [CORE/src/Http/ResponseEmitter.php, line 71]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/clients/8bab20da221b641bfd7b7ea783842e6e/sites/jeu-noel-grandlitier.fr/vendor/cakephp/cakephp/src/Error/Debugger.php:971) [CORE/src/Http/ResponseEmitter.php, line 168]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/clients/8bab20da221b641bfd7b7ea783842e6e/sites/jeu-noel-grandlitier.fr/vendor/cakephp/cakephp/src/Error/Debugger.php:971) [CORE/src/Http/ResponseEmitter.php, line 197]
I’m open to any leads, because I’m completely stuck at the moment.
Thanks in advance,
Alexis