strtotime() error

Home Forums Calendar Products Events Calendar PRO strtotime() error

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1029830
    terrizsolo
    Participant

    This error has popped up again. I can’t re-open the ticket but the details are here:

    strtotime error

    I recreated both of my recurring events after the last update (as detailed in the aforementioned ticket). The error went away.

    The Events Calendar plugin was updated to the latest version on 11/18. EC Pro was updated today 11/23. I started getting errors overnight 11/22 and 11/23. On 11/22 and 11/23, exclusion rules were added, one each day excluding the class of the previous day.

    The following error was logged:

    [22-Nov-2015 05:30:03 UTC] PHP Warning: strtotime() expects parameter 1 to be string, array given in /home/soloentr/public_html/blog/wp-content/plugins/events-calendar-pro/src/Tribe/Recurrence_Meta.php on line 1072

    Similar errors (2) were logged last night 11/23. Presumably, one for each exclusion.

    Brian (and I) spent considerable time trying to recreate the error. Brian was unable to do so, and we believed we had narrowed the problem down to only affecting legacy events. So as mentioned, I created two new events. I have no other recurring legacy events.

    Please help. This error doesn’t seem to affect function, but it creates and error and I get an email every day about it. I have to check it every day to make sure I don’t have another error besides this one, so it’s become a nuisance. And of course it creates havoc when it creates a new exclusion every day, creating an increasing number of errors every day. The only way to keep that number down is to edit the event and delete every darn exclusion.

    To me the error seems clear – the php function strtotime expects an argument, and there is none on line 1072. Regardless of what in my particular setup triggers that piece of code – it’s a flawed line.

    Please help!

    #1029914
    Brook
    Participant

    Howdy Terri,

    Thanks for getting back and summarizing what you’ve tried. I did read through the past topic, I appreciate the full background.

    To me the error seems clear โ€“ the php function strtotime expects an argument, and there is none on line 1072. Regardless of what in my particular setup triggers that piece of code โ€“ itโ€™s a flawed line.

    This is about to get technical. The array passed to array_map should contain strings, each string being a date. Then array_map calls the function strtotime for every string, passing it the string as an argument.

    However, I can picture one edge case where that does not happen – when the array is empty. I am not sure if this is dependent upon the PHP version or not, but it seems possible that in some version of PHP is the array is empty strtotime may still get called and passed something like null. A weird thing for PHP to do, but sometimes PHP is weird.

    Would you mind testing my hypothesis? Could you try replacing that line:

    $excluded = array_map( 'strtotime', self::get_excluded_dates( $event_id ) );

    With these lines:

    $excluded_dates = self::get_excluded_dates( $event_id );
    
    if ( !empty( $excluded_dates ) ) {
    	$excluded = array_map( 'strtotime', $excluded_dates );
    } else {
    	$excluded = array();
    }

    Now see if you stop getting new errors or useless exclusions added. Does that work?

    Cheers!

    – Brook

    #1030434
    terrizsolo
    Participant

    Hi Brook,

    I’ve changed those lines and we’ll see what happens overnight!

    Note: we are running PHP version 5.5.23

    #1032920
    Brook
    Participant

    Just checking in here, let me know if you do see any more errors. If not, I will add that code as a patch to an upcoming version, possibly to ย 4.0.x.

    Thanks!

    • Brook
    #1033502
    terrizsolo
    Participant

    Yikes. I wrote up a whole reply to this and it never posted. This has happened to me before…there must be an extra step to posting somewhere that I’ve been missing!

    Unfortunately:
    – I’m still getting the error message logged in my error_log file:

    [30-Nov-2015 05:19:11 UTC] PHP Warning: strtotime() expects parameter 1 to be string, array given in /home/soloentr/public_html/blog/wp-content/plugins/events-calendar-pro/src/Tribe/Recurrence_Meta.php on line 1078

    Line 1078 is:

    $excluded = array_map( ‘strtotime’, $excluded_dates );

    – I’m still seeing an exclusion generated, overnight, but now it’s for the day 30 days prior. I.e., last night it generated an exclusion for 10/31.

    – In error_log, there is an increasing number of errors each day – I haven’t counted, but previously it was one for each exclusion that exists.

    Sorry I don’t have better news.

    P.S.- now I see why stuff isn’t getting posted – I click submit, but it gives me an orange error message saying “ERROR: Are you sure you wanted to do that.” it refreshes the whole page, so I only see the error if I scroll down. If this P.S. is here, it means it went through on the second try…

    #1033505
    terrizsolo
    Participant

    Yep – second time the reply posted properly.

    Another bit of info – previously, I was getting exclusions only on one of my two recurring classes. Now, I’m seeing them on both…but only three on the one class have been registered so far, and I put in those changes to Recurrence_Meta.php on 11/24 so I’m a little baffled.

    Class #1 was created on 10/20 and now has exclusions every day from 10/23 to 10/31, a total of 9. (I believe this was the class I had previously been getting exclusions on but not sure. Also not sure if that is important. I had deleted all the previously-generated exclusions when I edited the Recurrence_Meta.php file as instructed. That’s 7 days so it doesn’t line up with the number of exclusions, which is a little strange.)

    Class #2 was created on 10/28 and now has exclusions every day from 10/29 to 10/31 (for a total of 3).

    #1033562
    Brook
    Participant

    Thanks for getting back. I am sorry even the forums are giving you troubles right now. :-/

    I see the database you shared with us is still available on Dropbox. I am going to examine it myself. I know Brian already tried to reproduce the error and wasn’t able. However, I am wondering if I can find anything strange about the exclusions array that is in your database. Please give me a couple days to get back to you, database dumps always take a bit longer than our usual support thread.

    Thanks!

    – Brook

    #1033599
    terrizsolo
    Participant

    Let me know if you need a new database backup, I’m happy to provide that ๐Ÿ™‚

    #1034802
    Brook
    Participant

    I will Terri, thanks. I think that anyone with an issue is sufficient. But, just oy be completely clear, can you let me know the names of the events that are seeing this problem? I want to be sure I’m looking in the right place.

    Cheers!

    – Brook

    #1035205
    terrizsolo
    Participant

    Sure! The two events are:

    – How to Stand Out With Your Message So Your Perfect Clients Fall in Love With You

    – 3 Simple Steps to Designing, Marketing, and Pricing Lucrative VIP Days

    They recur every every day.

    It’s possible that in the database you have, there are also nearly-identical versions of these classes that are marked Private and end in “-old” or similar. This is because as part of the troubleshooting, to eliminate legacy events as the cause, I created new events for each, but kept the old ones just in case. They’ve been deleted now for a week or two.

    Thanks!
    Terri Z

    #1037350
    Brook
    Participant

    Howdy Terri,

    Just an update. I was unable to open your database. I have tried a number of things but my server keeps crashing when I try to. I believe your version of MySQL is incompatible with my own. I am going to contact Brian and see if he can still open it up and investigate further. I will get back to you on the result.

    Thanks very much for your patience! Sorry this is taking longer than I’d like.

    • Brook
    #1037368
    terrizsolo
    Participant

    Well I bet that’s annoying! ๐Ÿ™

    I’m using MySQL version 5.6.27, if that helps…

    #1038514
    Brook
    Participant

    So a developer and I just had a confab about this and decided to log it as a bug. We have still not been able to reproduce the exact problem, but can see how a bug could be cropping up and what we could do to fix it. Thank you for reporting this Terri, and helping us narrow it down.

    In the mean time you might need to just ignore the error logs, or perhaps use a WP Cron tool to prevent this task from running every night and generating those errors. Hopefully one of these options will work for now while we craft a fix.

    Thanks again! Definitely hit me up with any questions you may have.

    – Brook

    #1038875
    terrizsolo
    Participant

    Thanks, Brook. I appreciate that it is being tagged as a bug – will I get notified when the fix is put into a release?

    #1039062
    Brook
    Participant

    Absolutely!ย And you are very welcome, happy you could work with us here.

    – Brook

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘strtotime() error’ is closed to new replies.