質問

I just tried upgrading from 2.4 to 2.4.1 and now the site is down.
We get this error only when trying to access the admin

{"0":"Type Error occurred when creating object: Magento\\Framework\\Session\\Generic\\Interceptor, setcookie() expects
parameter 3 to be integer, array given","1":"#1
Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:150]\n#2
Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:79]\n#3
Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:150]\n#4
Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:79]\n#5
Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:150]\n#6
Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:79]\n#7
Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('CsrfRequestValid...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:150]\n#8
Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('CsrfRequestValid...') called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:125]\n#9
Magento\\Framework\\ObjectManager\\Factory\\Compiled->parseArray(array('csrf_validator' => array('_i_' =>
'CsrfRequestValid...'), 'http_method_vali...' => array('_i_' => 'Magento\\Framewor...'))) called at
[vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:86]\n#10
Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('RequestValidator') called at
[vendor\/magento\/framework\/ObjectManager\/ObjectManager.php:70]\n#11
Magento\\Framework\\ObjectManager\\ObjectManager->get('RequestValidator') called at
[vendor\/magento\/framework\/App\/FrontController.php:86]\n#12
Magento\\Framework\\App\\FrontController->__construct(&Magento\\Framework\\App\\RouterList#0000000075152dce0000000037d45a14#,
&Magento\\Framework\\App\\Response\\Http\\Interceptor#0000000075152d9b0000000037d45a14#, NULL, NULL, NULL, NULL, NULL)
called at [generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php:14]\n#13
Magento\\Framework\\App\\FrontController\\Interceptor->__construct(&Magento\\Framework\\App\\RouterList#0000000075152dce0000000037d45a14#,
&Magento\\Framework\\App\\Response\\Http\\Interceptor#0000000075152d9b0000000037d45a14#, NULL, NULL, NULL, NULL, NULL)
called at [vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php:121]\n#14
Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\Framewor...',
array(&Magento\\Framework\\App\\RouterList#0000000075152dce0000000037d45a14#,
&Magento\\Framework\\App\\Response\\Http\\Interceptor#0000000075152d9b0000000037d45a14#, NULL, NULL, NULL, NULL, NULL))
called at [vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:108]\n#15
Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\Framewor...') called at
[vendor\/magento\/framework\/ObjectManager\/ObjectManager.php:70]\n#16
Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\Framewor...') called at
[vendor\/magento\/framework\/App\/Http.php:115]\n#17 Magento\\Framework\\App\\Http->launch() called at
[vendor\/magento\/framework\/App\/Bootstrap.php:263]\n#18
Magento\\Framework\\App\\Bootstrap->run(&Magento\\Framework\\App\\Http\\Interceptor#0000000075152d9d0000000037d45a14#)
called at
[pub\/index.php:40]\n","url":"\/","script_name":"\/index.php","report_id":"2a042cc9bf44183e0a485aa0ea00a58ca7ba84330b2acae02e570093fd1c26c6"}

Is this related to Support for the SameSite attribute for cookies that was introduced in 2.4.1?

役に立ちましたか?

解決

According to php documentation:

Version 7.3 ::: An alternative signature supporting an options array has been added. This signature supports also setting of the SameSite cookie attribute.

Your are probably running PHP version 7.2 (or some other version) that does not support the option array parameter.

You can check the PHP that the server is using by adding this to pub/index.php

phpinfo(); die();

Try to update your PHP version to 7.4 as Magento recommends it. Hope this helps!

他のヒント

The interceptor file needs to be re-create. So execute di:compile and clean cache

php bin/magento setup:di:compile
php bin/magento  cache:clean
ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top