Support » Plugin: Companion Auto Update » PHP Warning: strtotime() expects parameter 2 to be integer, string given in /wp

  • Resolved narkanister

    (@narkanister)


    Hi
    I receive endless PHP warnings from all my sites – will this bug be fixed soon please?

    Otherwise a great plugin!
    Many thanks
    Toby

    
    
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 03, 03:39:38] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 03, 02:11:35] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 317
    [Oct 03, 02:11:35] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 316
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 205
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 204
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 317
    [Oct 02, 10:10:52] PHP Warning:  strtotime() expects parameter 2 to be integer, string given in /wp-content/plugins/companion-auto-update/cau_functions.php on line 316
    
    • This topic was modified 7 months, 1 week ago by Yui.
    • This topic was modified 7 months, 1 week ago by Yui. Reason: please use CODE button for code formatting

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • wp_get_schedule works differently from wp_next_scheduled and returns a string (reoccurance value):
    https://developer.wordpress.org/reference/functions/wp_get_schedule/#comment-944

    This causes strtotime to fail. Please fix this in multiple places in the code. It was correct in 3.5.5

    • This reply was modified 6 months, 4 weeks ago by Marc Bernard.

    Same error, same cause..

    lines 204, 205, 316, 317 for me 🙂

    a fix would indeed be most welcome, my log files will thank you 🙂

    If you can’t wait for an official fix here is my solution :

    Line 205 replace :

    $range_start 	= date( 'Hi', strtotime( '-30 minutes', $updateSched) );
    $range_end 		= date( 'Hi', strtotime( '+30 minutes', $updateSched) );

    with :

    $update_time 	= wp_next_scheduled( 'wp_update_plugins' );
    $range_start 	= date( 'Hi', strtotime( '-30 minutes', $update_time ) );
    $range_end 		= date( 'Hi', strtotime( '+30 minutes', $update_time ) );

    and line 316 replace :

    // Check manual or automatic
    $range_start 	= date( 'Hi', strtotime( '-30 minutes', $updateSched) );
    $range_end 		= date( 'Hi', strtotime( '+30 minutes', $updateSched) );

    With :

    // Check manual or automatic
    $update_time 	= wp_next_scheduled( 'wp_version_check' );
    $range_start 	= date( 'Hi', strtotime( '-30 minutes', $update_time ) );
    $range_end 		= date( 'Hi', strtotime( '+30 minutes', $update_time ) );

    that’s what is done already for the themes updates check on line 263. I think the use of $updateSched as the second parameter might have be an oversight (or more likely a copy paste from lines 563 and later where the code goes like this :

    
    $updateSched 	= wp_next_scheduled( 'wp_update_plugins' );
    $range_start 	= date( 'Hi', strtotime( '-30 minutes', $updateSched ) );
    $range_end	= date( 'Hi', strtotime( '+30 minutes', $updateSched ) );
    
    Plugin Author Papin Schipper

    (@papin)

    Hi,

    So I’ve been having a few issues with my pc’s lately and wasn’t able to push a fix but I’m finally able to do so again. So I’ve just pushed update 3.7.1 that should fix all these errors.

    If the issue is not fixed for you please let me know and I’ll get back to it a.s.a.p. 🙂

    Thanks @boldairdeveloppement for the help! This made it so much easier for me to push a fix the moment I had my pc back.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Warning: strtotime() expects parameter 2 to be integer, string given in /wp’ is closed to new replies.