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

Argument should be array, boolean given #141

Open
bzneil opened this issue May 12, 2020 · 3 comments
Open

Argument should be array, boolean given #141

bzneil opened this issue May 12, 2020 · 3 comments

Comments

@bzneil
Copy link

bzneil commented May 12, 2020

When I try to load job configuration page I get this:

Argument 1 passed to EthanYehuda\CronjobManager\Helper\JobConfig::sanitizeJobConfig() must be of the type array, boolean given, called in vendor/ethanyehuda/magento2-cronjobmanager/Ui/Component/Listing/DataProviders/Cronjobmanager/Config/Grid.php on line 156

Any ideas?

@Ethan3600
Copy link
Owner

That's a new one @bzneil good catch. Can you give me a little more information as to how to reproduce this? Magento version, php version, steps to reproduce, etc. Are you running this locally?

@bzneil
Copy link
Author

bzneil commented May 12, 2020

Running on a hosted server,
Magento 2.3.4, PHP Version 7.2.27
Steps to reproduce:
Navigate to System>Tools>Cron Job Manager.
Dashboard, timeline, system configurations appear to load fine. But clicking on 'Job Configuration' provides the error

@Ethan3600
Copy link
Owner

I bet Magento switched their API.

In here: https://github.com/Ethan3600/magento2-CronjobManager/blob/1.x/Ui/Component/Listing/DataProviders/Cronjobmanager/Config/Grid.php#L156 we rely on a $job to be an associative array, but it gave us a boolean (based on the error).

So, it looks like $jobs = $this->manager->getCronJobs() (which calls Magento's internal API for grabbing cron jobs underneath the hood) gives us back something that looks like this:

[
    'group_name' => [
        'job_name' => false // or true
    ]
]

Instead of something like this:

[
    'group_name' => [
        'job_name' => [
            'name' => 'magento_cron_name',
            'group' => 'default',
            ...
        ]
    ]
]

We probably need to figure out why we're seeing a boolean there instead of an array and find a way to handle this situation to prevent it from causing this error.

(As a side note, this would make for a great "first time contribution" issue. Maybe I'll make a label or something)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants