CC-3956: PHP script can enter inifinite loop
-small cleanup
This commit is contained in:
parent
d1c224321b
commit
02b6d04952
|
@ -1362,27 +1362,25 @@ class Application_Model_Show {
|
|||
/* pass in only the year and month (not the day) */
|
||||
$dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone));
|
||||
|
||||
$dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone));
|
||||
|
||||
/* Keep adding 1 month, until we find the next month that contains the day
|
||||
* we are looking for (31st day for example) */
|
||||
do {
|
||||
$dt->add(new DateInterval($p_interval));
|
||||
} while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y")));
|
||||
|
||||
$dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d"));
|
||||
|
||||
$start = $dt->format("Y-m-d H:i:s");
|
||||
|
||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||
$utcStartDateTime = $dt;
|
||||
} else {
|
||||
$dt = new DateTime($start, new DateTimeZone($timezone));
|
||||
$dt->add(new DateInterval($p_interval));
|
||||
}
|
||||
|
||||
$start = $dt->format("Y-m-d H:i:s");
|
||||
|
||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||
$utcStartDateTime = $dt;
|
||||
}
|
||||
|
||||
return array($start, $utcStartDateTime);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue