laravel/framework — pull request #5384 by nc01 (2014-08-09 01:48:15+00:00)
Title: Fixes #5376 DateTime to minutes

Due to the way DateTime objects are converted to a number of minutes from now, it's possible to unintentionally cache something forever.

Example: the following code will put a value into the cache that lasts forever, but the code reads as if it should expire in 1 minute. In real use-cases, sleep(60) would be effected by a slow running database query, some slow network operation, or whatever.

$expiresAt = Carbon::now()->addMinutes(1);

$value = Cache::remember('users', $expiresAt, function()
{
sleep(60);
return true;
});

This PR changes the behaviour so that the value is simply not cached in this situation.