To keep it short, you code is failing because of an message like:
Why? Well it is obvious if your eyes are fresh, otherwise well hidden.
DateInterval::__construct(): Unknown or bad format (P0Y2M7DT-1H7M14S)
The bad thing is the "-" between "T" and "1". Cover your string by let it run through
How can this happen?
First of all, by strange data and secondly by trying to solve the date format on your own. Really, old code is your enemy at this point.
For the sake of input and output, here are some important links: