Skip to content
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

app:config:import stop when retrieve a warning or notice on php code #31428

Closed
rubenpurple opened this issue Dec 23, 2020 · 34 comments
Closed

app:config:import stop when retrieve a warning or notice on php code #31428

rubenpurple opened this issue Dec 23, 2020 · 34 comments
Labels
Area: Import / export Component: ImportExport Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@rubenpurple
Copy link

rubenpurple commented Dec 23, 2020

Hello, im trying to configure the pipeline system of Magento 2.4.

In the production system, the last step, i do the next commands:

/usr/local/bin/php bin/magento app:config:import
/usr/local/bin/php bin/magento setup:upgrade --keep-generated

As the documentation says. The problem, is when import the config.php file, i get the next error:

image

looking at the code:

image

The $time variable, get null from function: $this->getData('groups/productalert_cron/fields/time/value');

I changed the code so that if it is null, I left a zero as the value.

Then i try again, and now get the next error:
image

When i saw that error is a warning, i try to disable error_reporting in app/bootstrap.php:
//error_reporting(E_ALL);

and now, the import works fine.
image

I don't understand why I get these errors, caused by the values ​​returned by the functions, which are null.

I checked my database and config.php file, if I have the requested value:
image
image

now i have the doubt if avoiding error_reporting works fine the import function.

Reggards.

Additional Information

@m2-assistant
Copy link

m2-assistant bot commented Dec 23, 2020

Hi @rubenpurple. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ 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, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Jan 21, 2021

Hi @engcom-Delta. 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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - 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-Delta
Copy link
Contributor

Hi @rubenpurple thank you for your report, I'm not able to reproduce issue by steps you described on clean 2.4-develop
Manual testing scenario:

  • Enable error_reporting in app/bootstrap.php:
ini_set('display_errors', 1);
  • Add code into config.php:
        'default' => [
            'jobs' => [
                'sitemap_generate' => [
                    'schedule' => [
                        'cron_exp' => '0 0 * * *',
                    ],
                ],
                'catalog_product_alert' => [
                    'schedule' => [
                        'cron_exp' => '0 0 * * *',
                    ],
                    'run' => null,
                ],
            ],
        ],
    ],
  • Run bin/magento app:config:import

Result:
✔️ Import is finished without errors
image

Are my steps correct or something was missed?

@engcom-Delta engcom-Delta added the Issue: needs update Additional information is require, waiting for response label Jan 21, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jan 21, 2021
@metadan
Copy link

metadan commented Jan 22, 2021

I have this same issue whilst doing a site upgrade from 2.3.5 to 2.4

@rubenpurple
Copy link
Author

Hello, i was talking with my partner, and the magento was 2.3.4 upgrade to 2.4.

Its possible that the error only happens when upgrade? but not with clean new installation of 2.4 version?

@engcom-Delta engcom-Delta removed the Issue: needs update Additional information is require, waiting for response label Feb 26, 2021
@m2-community-project m2-community-project bot moved this from Needs Update to Ready for Confirmation in Issue Confirmation and Triage Board Feb 26, 2021
@engcom-Delta engcom-Delta added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Feb 26, 2021
@engcom-Delta engcom-Delta removed their assignment Feb 26, 2021
@barbazul
Copy link
Contributor

This is actually a very big bug.

AFAIK it affects the following areas:

  • Scheduled Import/Export Log Cleaning
  • Product Alert Cron
  • Sitemap Generation

The issue is that the same value being exported by app:config:dump cannot be read by app:config:imoprt, completely breaking the whole shared configuration deployment pipeline.

So far, the workaround we are using is

  • Run magento app:config:dump
  • Manually comment out the time and frequency settings in the resulting config.php file
  • Run magento app:config:import (to sync dev environment with updated configuration)
  • Commit fixed config.php
  • Push (then the whole pipeline runs...)

@stale
Copy link

stale bot commented Jun 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

@stale stale bot added the stale issue label Jun 3, 2021
@hostep
Copy link
Contributor

hostep commented Jun 4, 2021

Leaving a comment to prevent the stalebot from closing this automatically

@m2-assistant
Copy link

m2-assistant bot commented Jun 8, 2021

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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - 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-Hotel engcom-Hotel self-assigned this Jun 10, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jun 10, 2021

Hi @engcom-Hotel. 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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - 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-Hotel
Copy link
Contributor

Hi @rubenpurple,

We have checked this issue in Magento CLI 2.4.2-p1 with steps mentioned in the portal (https://devdocs.magento.com/guides/v2.4/config-guide/deployment/pipeline/technical-details.html). But the issue is not reproducible. We are going through with below steps:

  1. Start maintenance mode
  2. bin/magento app:config:import to import configuration changes.
  3. bin/magento setup:upgrade --keep-generated to update the database schema and data, preserving generated static files.
    But the issue is not reproducible. Please let us know if we missed anything.

@engcom-Hotel engcom-Hotel added the Issue: needs update Additional information is require, waiting for response label Jun 10, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jun 10, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Sep 28, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Sep 28, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Sep 30, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Oct 4, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Oct 4, 2021
@cmuench
Copy link
Contributor

cmuench commented Oct 8, 2021

Big issue for pipeline...

Same here. Gitlab-CI failed. We always to a fresh installation to test the setup process.

@cmuench
Copy link
Contributor

cmuench commented Oct 8, 2021

white_check_mark Jira issue https://jira.corp.magento.com/browse/AC-988 is successfully created for this GitHub issue.

@sidolov Not very transparent. How can we see the internals here? Maybe you can share more information.

@sidolov
Copy link
Contributor

sidolov commented Oct 8, 2021

@cmuench internal ticket in this case just a copy of GitHub issue. The internal team will pick the ticket according to the priority and all further updates will be reflected here.

@cmuench
Copy link
Contributor

cmuench commented Oct 8, 2021

@cmuench internal ticket in this case just a copy of GitHub issue. The internal team will pick the ticket according to the priority and all further updates will be reflected here.

ok. Thanks for clarification. I hope there will be a quality patch for that issue, soon.

@zakharevych
Copy link

zakharevych commented Oct 20, 2021

I fixed the issue with adding of the lines to app/etc/config.php

'frequency' => 'D',
'time' => '00,00,00',

in the 'catalog/productalert_cron' section

@engcom-Hotel
Copy link
Contributor

PR Merged

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Oct 26, 2021
@fredden
Copy link
Member

fredden commented Oct 26, 2021

@engcom-Hotel please can you add a reference to the pull request that fixes this. I'm struggling to find what pull request you're referring to.

@hostep
Copy link
Contributor

hostep commented Oct 26, 2021

I'm going to guess it's solved under AC-988::Fixing app:config:import issue after config dump

But @fredden is correct, next time @engcom-Hotel please provide more info when you close an issue. It's often very helpful for people so they can make patches out of the PR's if they want a quick fix on their shop.

@engcom-Hotel
Copy link
Contributor

@hostep Sure I will take care of the same in the future.

@cmuench
Copy link
Contributor

cmuench commented Nov 11, 2021

@sidolov Any chance to publish an official quality patch for that issue?

@sidolov
Copy link
Contributor

sidolov commented Nov 22, 2021

Hi @cmuench! You may create a pull request to 2.3.7-release or 2.4.3-release branch to deliver the patch, or use https://github.com/magento/quality-patches/ repo directly

@densen45
Copy link
Contributor

I experienced that the merge that @hostep referenced in #31428 (comment) solves only part of the issue.

After applying the modifications to the Alert.php and Sitemap.php I get the following error:

Import failed: Notice: Trying to access array offset on value of type null in [..]/vendor/magento/module-config/Model/Config/Backend/Currency/Cron.php on line 66

The changes applied to the Alert.php and Sitemap.php need to be applied to the Cron.php as well.

-            (int)$time[1],                                 # Minute
-            (int)$time[0],                                 # Hour
+            (int)($time[1] ?? 0),                                 # Minute
+            (int)($time[0] ?? 0),                                 # Hour

Has anyone else experienced this?

@Aquive
Copy link

Aquive commented Aug 12, 2022

@densen45 works, thanks!

In addition I got the following error:

application/vendor/amasty/module-xml-google-sitemap/Model/Config/Cron.php on line 52

The fix is the same:

-            (int)$timeConfig[1],
-            (int)$timeConfig[0],
+           (int)($timeConfig[1] ?? 0),
+           (int)($timeConfig[0] ?? 0),

@hostep
Copy link
Contributor

hostep commented Aug 12, 2022

@Aquive: can you notify Amasty about this and reference this issue in your ticket, so they know what this is about and they can fix it as well on their end, thanks! 🙂

@densen45: could you create a new issue for this here on github? It appears Adobe forgot to fix it for currency rates update cronjob.
Also the following cronjobs might still be affected:

Thanks! 🙂

@dossy
Copy link

dossy commented Dec 20, 2023

I just ran into this issue with Magento\ScheduledImportExport\Model\System\Config\Backend\Logclean\Cron (vendor/magento/module-scheduled-import-export/Model/System/Config/Backend/Logclean/Cron.php), and found this issue.

Here's a patch for anyone else who needs it:

--- a/vendor/magento/module-scheduled-import-export/Model/System/Config/Backend/Logclean/Cron.php 2023-12-20 02:52:12.287897448 +0000
+++ b/vendor/magento/module-scheduled-import-export/Model/System/Config/Backend/Logclean/Cron.php 2023-12-20 03:05:54.156095976 +0000
@@ -55,8 +55,14 @@
      */
     public function afterSave()
     {
-        $time = $this->getData('groups/magento_scheduled_import_export_log/fields/time/value');
-        $frequency = $this->getData('groups/magento_scheduled_import_export_log/fields/frequency/value');
+        $time = $this->getData('groups/magento_scheduled_import_export_log/fields/time/value') ?:
+            explode(',', $this->getValue());
+        $frequency = $this->getData('groups/magento_scheduled_import_export_log/fields/frequency/value') ?:
+            $this->_config->getValue(
+                'system/magento_scheduled_import_export_log/frequency',
+                $this->getScope(),
+                $this->getScopeId()
+            );
 
         $frequencyDaily = \Magento\Cron\Model\Config\Source\Frequency::CRON_DAILY;
         $frequencyWeekly = \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Import / export Component: ImportExport Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Development

No branches or pull requests