Deprecated: Using null as an array offset is deprecated, use an empty string instead in /home/xb23/htdocs/www.xb23.net/wp-content/plugins/breakdance/plugin/lib/mozart-scoped-psr4/Twig/Extension/CoreExtension.php on line 1447

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /home/xb23/htdocs/www.xb23.net/wp-content/plugins/breakdance/plugin/lib/mozart-scoped-psr4/Twig/Extension/CoreExtension.php on line 1447

Magento 2 – Disabling CSP in 2.4.6-p6+

As of version 2.4.6-p6+ Magento 2 now puts pages that contain payment information into enforced CSP mode, before it was in Report-Only mode. Now the change is good but it does break things, here is how you can temporarily put them back into reporting mode and allowing inline scripts.

Add this into the env.php file

'system' => [
            'default' => [
                'csp' => [
                   'mode' => [
                      'storefront_checkout_index_index' => [
                         'report_only' => '1'
                      ],
                      'admin_sales_order_create_index' => [
                        'report_only' => '1'
                      ]
                   ],
                   'policies' => [
                      'storefront_checkout_index_index' => [
                        'scripts' => [
                            'inline' => '1'
                        ]
                      ],
                      'admin_sales_order_create_index' => [
                        'scripts' => [
                            'inline' => '1'
                        ]
                      ]
                   ]
                ]
            ]
        ]

Then in terminal run this:

bin/magento app:config:import

And voila! – Everything will now be working again.

    Leave a Reply

    Your email address will not be published. Required fields are marked *