• Resolved cnfarinella

    (@cnfarinella)


    When I set the schedule in Object Sync for Salesforce in prompts a Critical error on the front end of the site.

    When I view the error logs I see this:

    PHP Fatal error: Uncaught TypeError: DateTime::__construct(): Argument #1 ($datetime) must be of type string, array given in /nas/content/live/bespokerealdev/wp-content/plugins/object-sync-for-salesforce/vendor/woocommerce/action-scheduler/functions.php:336

    Any Help with this issue would be great!

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I’ve never seen this happen before. What version of PHP are you using?

    Thread Starter cnfarinella

    (@cnfarinella)

    Jonathan.

    It was 8.0 then I downgraded to 7.4.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Did you see this error in both versions?

    Also, what are the settings you are using on the scheduling tab? For example, here’s a screenshot of what we use for those settings at MinnPost.

    I think if it isn’t a settings issue, it’s possible that your system has an issue with Action Scheduler, the third party library that we use to enqueue tasks.

    Thread Starter cnfarinella

    (@cnfarinella)

    Yes happened in both versions.

    I copied those exact settings and it still prompts me with the error. Since the error kicks in it doesnt save the settings so its when I return to view the fields they are blank.

    Thread Starter cnfarinella

    (@cnfarinella)

    whats strange is i cant find this file directory in the plugin root

    vendor/woocommerce/action-scheduler/functions.php

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Action Scheduler certainly should be part of the plugin. For example, here it is in the WordPress plugin directory’s version: https://plugins.trac.wordpress.org/browser/object-sync-for-salesforce/trunk/vendor/woocommerce/action-scheduler/functions.php

    If you don’t have that file or the directory that it is in, you might need to reinstall the plugin. If you installed the plugin from GitHub, it’s probably not there, but you should follow the developer installation instructions in that case.

    Thread Starter cnfarinella

    (@cnfarinella)

    So i reinstalled everything and installed Action Scheduler again now i get this faatal error:

    Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string, array given in /nas/content/live/bespokerealdev/wp-content/plugins/action-scheduler/functions.php:336\nStack trace:\n#0 /nas/content/live/bespokerealdev/wp-content/plugins/action-scheduler/functions.php(336): DateTime->__construct(Array, Object(DateTimeZone))\n#1 /nas/content/live/bespokerealdev/wp-content/plugins/action-scheduler/classes/ActionScheduler_ActionFactory.php(114): as_get_datetime_object(Array)\n#2 /nas/content/live/bespokerealdev/wp-content/plugins/action-scheduler/classes/ActionScheduler_ActionFactory.php(149): ActionScheduler_ActionFactory->single_unique(‘object_sync_for…’, false, Array, 1666890590, ‘salesforce_pull…’)\n#3 /nas/content/live/bespokerealdev/wp-content/plugins/action-scheduler/functions.php(59): ActionScheduler_ActionFactory->recurring_unique(‘object_sync_for…’, Array, 1666890590, 0, ‘salesforce_pull…’, false)\n#4 /nas/content/live/bespokerealdev/wp-content/plugins/object-sync-for-salesforce/classes/c in /nas/content/live/bespokerealdev/wp-content/plugins/action-scheduler/functions.php on line 336, referer:`

    • This reply was modified 1 year, 10 months ago by cnfarinella.
    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Maybe try installing the full plugin manually. You can download a zip file from the plugin directory here: https://downloads.wordpress.org/plugin/object-sync-for-salesforce.zip

    Thread Starter cnfarinella

    (@cnfarinella)

    Ok so I FTP to the site and see the folders in there. I dont know why I cant see them through the WP editor. Anyway Im still getting that error:

    I updated the site to newest version of WP

    Tried both 7.4 & 8.0 PHP

    Played with the time settings in WP to be UTC, My local time

    uninstalled every plugin on the site

    Im not 100% sure what else to do with this issue

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I’m not sure. Since you’ve tried with multiple WP versions and multiple PHP versions, my guess is that something is missing from your/your host’s PHP configuration, but I don’t know what it might be. It may be that the plugin won’t work for you, but if that is the case it would be nice to know what requirement is preventing it.

    Thread Starter cnfarinella

    (@cnfarinella)

    Whats strange is im hosting on a dedicated server with a few other sites and im using the object sync on another site and it works just fine.

    Thread Starter cnfarinella

    (@cnfarinella)

    Jonathan,

    Just to give you a update I got this to work by installing a older version of the plugin version Version 2.1.2 .

    I dont know why Version 2.2.5 didnt work

    Thanks

    Chris

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Interesting. There were a lot of changes between 2.1.2 and 2.2.5. Although most of the changes were small, certainly not all of them were, so if none of the in-between versions work it’s very hard to say what could cause something like that. Especially if you’ve got 2.2.5 running on another site on the same server.

    @jonathanstegall I believe the issue is a difference in the ActionScheduler_ActionFactory.php class between 2.1.2 and 2.2.5. The function recurring_unique() calls single_unique() with the $args argument in place of the $first argument (hence an error when trying to parse an empty array as a string)

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    @jditt0 interesting. I’m willing to add a GitHub issue to the Action Scheduler repository asking about this, and see what they think about it.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Scheduling Prompts a critical error’ is closed to new replies.