diff --git a/src/Illuminate/Bus/DatabaseBatchRepository.php b/src/Illuminate/Bus/DatabaseBatchRepository.php index 4333c515ac79..a4ede3253185 100644 --- a/src/Illuminate/Bus/DatabaseBatchRepository.php +++ b/src/Illuminate/Bus/DatabaseBatchRepository.php @@ -374,9 +374,9 @@ protected function toBatch($batch) (int) $batch->failed_jobs, (array) json_decode($batch->failed_job_ids, true), $this->unserialize($batch->options), - CarbonImmutable::createFromTimestamp($batch->created_at), - $batch->cancelled_at ? CarbonImmutable::createFromTimestamp($batch->cancelled_at) : $batch->cancelled_at, - $batch->finished_at ? CarbonImmutable::createFromTimestamp($batch->finished_at) : $batch->finished_at + CarbonImmutable::createFromTimestamp($batch->created_at, date_default_timezone_get()), + $batch->cancelled_at ? CarbonImmutable::createFromTimestamp($batch->cancelled_at, date_default_timezone_get()) : $batch->cancelled_at, + $batch->finished_at ? CarbonImmutable::createFromTimestamp($batch->finished_at, date_default_timezone_get()) : $batch->finished_at ); } diff --git a/src/Illuminate/Bus/DynamoBatchRepository.php b/src/Illuminate/Bus/DynamoBatchRepository.php index 7753fa21297c..b0dc34a10733 100644 --- a/src/Illuminate/Bus/DynamoBatchRepository.php +++ b/src/Illuminate/Bus/DynamoBatchRepository.php @@ -411,9 +411,9 @@ protected function toBatch($batch) (int) $batch->failed_jobs, $batch->failed_job_ids, $this->unserialize($batch->options) ?? [], - CarbonImmutable::createFromTimestamp($batch->created_at), - $batch->cancelled_at ? CarbonImmutable::createFromTimestamp($batch->cancelled_at) : $batch->cancelled_at, - $batch->finished_at ? CarbonImmutable::createFromTimestamp($batch->finished_at) : $batch->finished_at + CarbonImmutable::createFromTimestamp($batch->created_at, date_default_timezone_get()), + $batch->cancelled_at ? CarbonImmutable::createFromTimestamp($batch->cancelled_at, date_default_timezone_get()) : $batch->cancelled_at, + $batch->finished_at ? CarbonImmutable::createFromTimestamp($batch->finished_at, date_default_timezone_get()) : $batch->finished_at ); } diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 10187f50d701..94e6e95f5288 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -1459,7 +1459,7 @@ protected function asDateTime($value) // and format a Carbon object from this timestamp. This allows flexibility // when defining your date fields as they might be UNIX timestamps here. if (is_numeric($value)) { - return Date::createFromTimestamp($value); + return Date::createFromTimestamp($value, date_default_timezone_get()); } // If the value is in simply year, month, day format, we will instantiate the diff --git a/src/Illuminate/Http/Middleware/SetCacheHeaders.php b/src/Illuminate/Http/Middleware/SetCacheHeaders.php index 6229e4cfd171..4b34061ae715 100644 --- a/src/Illuminate/Http/Middleware/SetCacheHeaders.php +++ b/src/Illuminate/Http/Middleware/SetCacheHeaders.php @@ -56,7 +56,7 @@ public function handle($request, Closure $next, $options = []) if (isset($options['last_modified'])) { if (is_numeric($options['last_modified'])) { - $options['last_modified'] = Carbon::createFromTimestamp($options['last_modified']); + $options['last_modified'] = Carbon::createFromTimestamp($options['last_modified'], date_default_timezone_get()); } else { $options['last_modified'] = Carbon::parse($options['last_modified']); } diff --git a/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php b/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php index 226c752e94ef..a6df62e6a251 100644 --- a/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php +++ b/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php @@ -119,7 +119,7 @@ public function all() 'payload' => $result['payload']['S'], 'exception' => $result['exception']['S'], 'failed_at' => Carbon::createFromTimestamp( - (int) $result['failed_at']['N'] + (int) $result['failed_at']['N'], date_default_timezone_get() )->format(DateTimeInterface::ISO8601), ]; })->all(); @@ -152,7 +152,7 @@ public function find($id) 'payload' => $result['Item']['payload']['S'], 'exception' => $result['Item']['exception']['S'], 'failed_at' => Carbon::createFromTimestamp( - (int) $result['Item']['failed_at']['N'] + (int) $result['Item']['failed_at']['N'], date_default_timezone_get() )->format(DateTimeInterface::ISO8601), ]; } diff --git a/src/Illuminate/Support/Sleep.php b/src/Illuminate/Support/Sleep.php index e5ae861834c7..ebb8f4215b03 100644 --- a/src/Illuminate/Support/Sleep.php +++ b/src/Illuminate/Support/Sleep.php @@ -92,7 +92,7 @@ public static function for($duration) public static function until($timestamp) { if (is_numeric($timestamp)) { - $timestamp = Carbon::createFromTimestamp($timestamp); + $timestamp = Carbon::createFromTimestamp($timestamp, date_default_timezone_get()); } return new static(Carbon::now()->diff($timestamp)); diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 02a179171619..7cc4261b24e0 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -432,7 +432,7 @@ public function assertCookieExpired($cookieName) "Cookie [{$cookieName}] not present on response." ); - $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); + $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime(), date_default_timezone_get()); PHPUnit::assertTrue( $cookie->getExpiresTime() !== 0 && $expiresAt->lessThan(Carbon::now()), @@ -455,7 +455,7 @@ public function assertCookieNotExpired($cookieName) "Cookie [{$cookieName}] not present on response." ); - $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); + $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime(), date_default_timezone_get()); PHPUnit::assertTrue( $cookie->getExpiresTime() === 0 || $expiresAt->greaterThan(Carbon::now()),