Home › Forums › Calendar Products › Events Calendar PRO › strtotime() error
- This topic has 15 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
November 23, 2015 at 1:51 pm #1029830
terrizsolo
ParticipantThis error has popped up again. I can’t re-open the ticket but the details are here:
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!
November 23, 2015 at 11:15 pm #1029914Brook
ParticipantHowdy 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
November 24, 2015 at 4:37 pm #1030434terrizsolo
ParticipantHi Brook,
I’ve changed those lines and we’ll see what happens overnight!
Note: we are running PHP version 5.5.23
November 30, 2015 at 7:58 pm #1032920Brook
ParticipantJust 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
December 1, 2015 at 4:19 pm #1033502terrizsolo
ParticipantYikes. 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…
December 1, 2015 at 4:33 pm #1033505terrizsolo
ParticipantYep – 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).
December 1, 2015 at 10:32 pm #1033562Brook
ParticipantThanks 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
December 2, 2015 at 12:43 am #1033599terrizsolo
ParticipantLet me know if you need a new database backup, I’m happy to provide that ๐
December 3, 2015 at 9:55 am #1034802Brook
ParticipantI 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
December 3, 2015 at 8:54 pm #1035205terrizsolo
ParticipantSure! 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 ZDecember 8, 2015 at 1:43 am #1037350Brook
ParticipantHowdy 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
December 8, 2015 at 2:35 am #1037368terrizsolo
ParticipantWell I bet that’s annoying! ๐
I’m using MySQL version 5.6.27, if that helps…
December 9, 2015 at 3:23 pm #1038514Brook
ParticipantSo 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
December 10, 2015 at 7:45 am #1038875terrizsolo
ParticipantThanks, Brook. I appreciate that it is being tagged as a bug – will I get notified when the fix is put into a release?
December 10, 2015 at 11:58 am #1039062Brook
ParticipantAbsolutely!ย And you are very welcome, happy you could work with us here.
– Brook
-
AuthorPosts
- The topic ‘strtotime() error’ is closed to new replies.
