OK I think I have found a pretty strange bug.
I have 2 objects of the type DateInterval and is trying to evaluate if one is bigger than the other - however this fails unless I do a var_dump() on both objects first!
1st example
//** THIS WORKS AND EVALUATES TO TRUE WHEN SUPPOSED TO!
var_dump($sum_off);
var_dump($n_off);
if($sum_off >= $n_off){
$running = FALSE;
$sum_on = new DateInterval('P0000-00-00T00:00:00');
$sum_off = new DateInterval('P0000-00-00T00:00:00');
$first_off = NULL;
}
2nd example
//** THIS NEVER EVALUATES TO TRUE!
var_dump($n_off);
if($sum_off >= $n_off){
$running = FALSE;
$sum_on = new DateInterval('P0000-00-00T00:00:00');
$sum_off = new DateInterval('P0000-00-00T00:00:00');
$first_off = NULL;
}
3rd example
//** THIS ALWAYS EVALUATES TO TRUE!
var_dump($sum_off);
if($sum_off >= $n_off){
$running = FALSE;
$sum_on = new DateInterval('P0000-00-00T00:00:00');
$sum_off = new DateInterval('P0000-00-00T00:00:00');
$first_off = NULL;
}
I'm getting a bit frustrated...
....additional info
these are the var_dump() - they are run in a foreach loop so the $sum_off variable might hold values bigger or smaller than this.
object(DateInterval)#17 (15) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(0)
["h"]=>
int(9)
["i"]=>
int(59)
["s"]=>
int(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
object(DateInterval)#22 (15) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(0)
["h"]=>
int(0)
["i"]=>
int(10)
["s"]=>
int(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}