Recent Topics

1 Oct 08, 2011 21:36    

My b2evolution Version: 4.0.5

When I run the getmail.php, I get a cannot parse date header error.
What is happening. The script has been running up until this point.

2 Oct 08, 2011 23:22

Edit the following in getmail.php around the line 255

Replace this

// Parse Date.
// TODO: dh> use strftime (after format validation)? or strptime (PHP>=5.1.0)
// of the form '20 Mar 2002 20:32:37'
if(!preg_match('#^(.{3}, )?(\d{2}) (.{3}) (\d{4}) (\d{2}):(\d{2}):(\d{2})#', $ddate, $match))
{
	echo_message( 'Could not parse date header!', ERROR, 0);
	//pre_dump($ddate);
	return false;
}

$dmonths = array(
	'Jan' => 1,
	'Feb' => 2,
	'Mar' => 3,
	'Apr' => 4,
	'May' => 5,
	'Jun' => 6,
	'Jul' => 7,
	'Aug' => 8,
	'Sep' => 9,
	'Oct' => 10,
	'Nov' => 11,
	'Dec' => 12,
);

$ddate_H = $match[5];
$ddate_i = $match[6];
$ddate_s = $match[7];

if( ! isset( $dmonths[$match[3]] ) )
{
	echo_message( 'Invalid month name in message date string.', ERROR, 0 );
	return false;
}
$ddate_m = $dmonths[$match[3]];
$ddate_d = $match[2];
$ddate_Y = $match[4];

$ddate_U = mktime( $ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y );
$post_date = date( 'Y-m-d H:i:s', $ddate_U );

return true;

With this

// Parse Date
if(!preg_match('#^(.{3}, )?(\d{2}) (.{3}) (\d{4}) (\d{2}):(\d{2}):(\d{2})#', $ddate, $match))
{
	$ddate_U = @strtotime($ddate);
	if( empty($ddate_U) || strlen($ddate_U) < 2 )
	{
		echo_message( sprintf( 'Could not parse date header "%s"', $ddate ), ERROR, 0);
		return false;
	}
}

if( empty($ddate_U) )
{
	$dmonths = array(
		'Jan' => 1,
		'Feb' => 2,
		'Mar' => 3,
		'Apr' => 4,
		'May' => 5,
		'Jun' => 6,
		'Jul' => 7,
		'Aug' => 8,
		'Sep' => 9,
		'Oct' => 10,
		'Nov' => 11,
		'Dec' => 12,
	);

	$ddate_H = $match[5];
	$ddate_i = $match[6];
	$ddate_s = $match[7];

	if( ! isset( $dmonths[$match[3]] ) )
	{
		echo_message( 'Invalid month name in message date string.', ERROR, 0 );
		return false;
	}
	$ddate_m = $dmonths[$match[3]];
	$ddate_d = $match[2];
	$ddate_Y = $match[4];

	$ddate_U = mktime( $ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y );
}

$post_date = date( 'Y-m-d H:i:s', $ddate_U );

echo_message( 'Date: ' . $post_date, INFO, 3 );

return true;

3 Oct 09, 2011 18:29

I just noticed that thee is a 4.1.1 release. I may just upgrade. Is this already fixed in the 4.1.1 release or will I have to change it there too.

4 Oct 09, 2011 20:19

The fix is not there yet. Expect it in b2evo 4.2.x

5 Apr 11, 2012 22:41

So is this still going to be fix in 4.2.x? and when is 4.2.x eta?

6 Apr 12, 2012 00:49

v4.2 was transformed into v5 :)
There's still no public version around, only devs have access to it.


Form is loading...