PHP 5.4.11中的DateTime问题[关闭]

Im using the code below in PHP 5.3, but now i have to run it on 5.4.11 and it does not work. No errors on page, and i got 500 error. If i comment the last 3 lines, everything is OK.

$sql = "*****";
$query = mysqli_query($dbc, $sql) or die('Error selecting date range.');
$row = mysqli_fetch_array($query);
$firstDate = $row['min'];
$lastDate = $row['max'];
$arrDates = array();
$date1 = new DateTime($firstDate);
$date2 = new DateTime($lastDate);
$interval = $date1->diff($date2);

EDIT1: var_dump for $firstDate and $lastDate, impossible to get one for $date1 and $date2 as everything stops the moment i uncomment the objects.

$firstDate - string(10) "2013-01-27"
$lastDate - string(10) "2013-02-06"

Any suggestions?

I have found in the past that it is more reliable to use the static createFromFormat method to generate DateTime objects if you know the format of your input string in advance:

$date1 = DateTime::createFromFormat($format, $firstDate);
$date2 = DateTime::createFromFormat($format, $lastDate);
$interval = $date1->diff($date2);