ManjilShahi Posted December 27, 2015 Share Posted December 27, 2015 I use the theme as an affiliate deals aggregator. I am using WP all import plugin to import deals from xml files. On import, I face a major problem concerning the expire date as in every xml, it is in the format: “2015-04-23 00:00:00”, while your theme requires UNIX timestamp and can not convert. I used strtotime() in wp all import to convert date to timestamp in real time. But im getting this error : Warning: date() expects parameter 2 to be long, string given in /home/xxxx/xxxxx.com/wp-includes/functions.php on line 112/114/116 and 117 The functions.php file : function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { global $wp_locale; $i = $unixtimestamp; if ( false === $i ) { if ( ! $gmt ) $i = current_time( 'timestamp' ); else $i = time(); // we should not let date() interfere with our // specially computed timestamp $gmt = true; } /* * Store original value for language with untypical grammars. * See https://core.trac.wordpress.org/ticket/9396 */ $req_format = $dateformatstring; $datefunc = $gmt? 'gmdate' : 'date'; if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );-----------LINE 112 $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); $dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );------LINE 114 $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); $datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );----LINE 116 $datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i) );------LINE 117 $dateformatstring = ' '.$dateformatstring; $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring ); $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); } Quote Link to comment https://forums.phpfreaks.com/topic/300021-warning-date-expects-parameter-2-to-be-long-string-error/ Share on other sites More sharing options...
requinix Posted December 27, 2015 Share Posted December 27, 2015 Looks like something is calling date_i18n() with a $unixtimestamp that isn't a number... Do you have any ideas where that may be? Look for a place that's showing bad date strings. Quote Link to comment https://forums.phpfreaks.com/topic/300021-warning-date-expects-parameter-2-to-be-long-string-error/#findComment-1528649 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.