Skip to content

Undefined array key "simple_free_shipping" - vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php #39827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 5 tasks
rossparachute opened this issue Apr 17, 2025 · 4 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6-p10 Indicates original Magento version for the Issue report.

Comments

@rossparachute
Copy link

Preconditions and environment

We've noticed this is a problem, likely only on 2.4.6 and below as the 2.4-develop sorted it. We've never got that via composer though. Patch below.

Saves you having to create a plugin or edit the line every patch install on affected versions.

Marked as S1 severity as the client could no longer create any cart price sales rules.

Environment

  • v2.4.6-p10
  • PHP v8.1
  • MariaDB v10.5
  • ElasticSearch v7.17
  • Debian GNU/Linux 11 (bullseye), Linux 5.10.0-33-cloud-amd64

Steps to reproduce

  1. Marketing > Cart Price Rules
  2. Create a blank rule, don't check "Apply to Shipping Amount"
  3. Save the rule
  4. The WSOD will show and the following exception will be logged
main.CRITICAL: Exception: Warning: Undefined array key "simple_free_shipping" in <mnt_path>/public_html/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php on line 67 in <mnt_path>/public_html/vendor/magento/framework/App/ErrorHandler.php:62
Stack trace:
#0 <mnt_path>/public_html/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php(67): Magento\Framework\App\ErrorHandler->handler()
#1 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save->execute()
#2 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->___callParent()
#3 <mnt_path>/public_html/vendor/meta/module-business-extension/Plugin/LoggingPluginBase.php(137): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->Magento\Framework\Interception\{closure}()
#4 <mnt_path>/public_html/vendor/meta/module-business-extension/Plugin/LoggingPluginBase.php(85): Meta\BusinessExtension\Plugin\LoggingPluginBase->wrapCallableWithLogging()
#5 <mnt_path>/public_html/vendor/meta/module-business-extension/Plugin/LoggingActionPlugin.php(45): Meta\BusinessExtension\Plugin\LoggingPluginBase->wrapCallableWithErrorAndImpressionLogging()
#6 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Meta\BusinessExtension\Plugin\LoggingActionPlugin->aroundExecute()
#7 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->Magento\Framework\Interception\{closure}()
#8 <mnt_path>/public_html/generated/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save/Interceptor.php(23): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->___callPlugins()
#9 <mnt_path>/public_html/vendor/magento/framework/App/Action/Action.php(111): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->execute()
#10 <mnt_path>/public_html/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#11 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch()
#12 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->___callParent()
#13 <mnt_path>/public_html/app/code/WeltPixel/Backend/Plugin/Utility.php(76): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->Magento\Framework\Interception\{closure}()
#14 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(135): WeltPixel\Backend\Plugin\Utility->aroundDispatch()
#15 <mnt_path>/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(145): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->Magento\Framework\Interception\{closure}()
#16 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
#17 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->Magento\Framework\Interception\{closure}()
#18 <mnt_path>/public_html/generated/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save/Interceptor.php(32): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->___callPlugins()
#19 <mnt_path>/public_html/vendor/magento/framework/App/FrontController.php(245): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save\Interceptor->dispatch()
#20 <mnt_path>/public_html/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#21 <mnt_path>/public_html/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#22 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#23 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#24 <mnt_path>/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#25 <mnt_path>/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#26 <mnt_path>/public_html/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#27 <mnt_path>/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#28 <mnt_path>/public_html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#29 <mnt_path>/public_html/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#30 {main} {"report_id":"89c61a7fb8a29743074bb5d254220de33d132809d6da7fe2140b4ff8bb13c6d3","exception":"[object] (Exception(code: 0): Warning: Undefined array key \"simple_free_shipping\" in <mnt_path>/public_html/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php on line 67 at <mnt_path>/public_html/vendor/magento/framework/App/ErrorHandler.php:62)"} []

Expected result

The rule is saved successfully.

Actual result

The rule is not saved successfully and a WSOD is shown.

Additional information

Fix
How to Apply
Patch via Composer

20250417-Magento-SalesRule-Controller-Adminhtml-Promo-Quote.patch

From: Ross Parachute <[email protected]>
Date: Thu, 17 Apr 2025 10:49:52 +0000
Subject: [PATCH] Magento/SalesRule/Controller/Adminhtml/Promo/Quote
 /Save.php::L67 null coalesce ternary fix

---
 .../module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php b/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php
index e407142..aefadd0 100644
--- a/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php
+++ b/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Save.php
@@ -64,7 +64,7 @@ class Save extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote implement
     {
         $data = $this->getRequest()->getPostValue();
         if ($data) {
-            $data['simple_free_shipping'] = ($data['simple_free_shipping'] === '')
+            $data['simple_free_shipping'] = (($data['simple_free_shipping'] ?? '') === '')
                     ? null : $data['simple_free_shipping'];
 
             try {
-- 
2.30.2

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Apr 17, 2025

Hi @rossparachute. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

Copy link

m2-assistant bot commented Apr 17, 2025

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.6-p10 Indicates original Magento version for the Issue report. label Apr 17, 2025
@engcom-Bravo
Copy link
Contributor

Hi @rossparachute,

Thanks for your reporting and collaboration.

We have tried to reproduce the issue in latest 2.4-develop instance and we are not able to reproduce the issue.Kindly refer the attached video.

Screen.Recording.2025-04-21.at.3.57.41.pm.mov

The rule is saved successfully.

Kindly recheck the issue in latest 2.4-develop instance and elaborate the steps to reproduce if the issue is still reproducible.

Thanks.

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Apr 21, 2025
@ct-prd-projects-boards-automation ct-prd-projects-boards-automation bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Apr 21, 2025
@engcom-Bravo
Copy link
Contributor

Hi @rossparachute,

This issue is being closed since it has not been updated in a long time.Please feel free to reopen or raise a new ticket if the issue still exists.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6-p10 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

2 participants