Skip to content

Commit 8f9b14f

Browse files
Merge branch '8.x' into 9.x
2 parents 695d6dc + 98aa74a commit 8f9b14f

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

src/Illuminate/Cache/Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ protected function getSeconds($ttl)
529529
$duration = Carbon::now()->diffInRealSeconds($duration, false);
530530
}
531531

532-
return (int) $duration > 0 ? $duration : 0;
532+
return (int) ($duration > 0 ? $duration : 0);
533533
}
534534

535535
/**

src/Illuminate/Collections/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,8 @@ public function nth($step, $offset = 0)
846846

847847
$position = 0;
848848

849-
foreach ($this->items as $item) {
850-
if ($position % $step === $offset) {
849+
foreach ($this->slice($offset)->items as $item) {
850+
if ($position % $step === 0) {
851851
$new[] = $item;
852852
}
853853

src/Illuminate/Collections/LazyCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ public function nth($step, $offset = 0)
848848
return new static(function () use ($step, $offset) {
849849
$position = 0;
850850

851-
foreach ($this as $item) {
852-
if ($position % $step === $offset) {
851+
foreach ($this->slice($offset) as $item) {
852+
if ($position % $step === 0) {
853853
yield $item;
854854
}
855855

src/Illuminate/Database/Connection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ protected function reconnectIfMissingConnection()
829829
public function disconnect()
830830
{
831831
$this->setPdo(null)->setReadPdo(null);
832+
833+
$this->doctrineConnection = null;
832834
}
833835

834836
/**

src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function bootstrap(Application $app)
2424
// First we will see if we have a cache configuration file. If we do, we'll load
2525
// the configuration items from that file so that it is very quick. Otherwise
2626
// we will need to spin through every configuration file and load them all.
27-
if (is_file($cached = $app->getCachedConfigPath())) {
27+
if (file_exists($cached = $app->getCachedConfigPath())) {
2828
$items = require $cached;
2929

3030
$loadedFromCache = true;

tests/Support/SupportCollectionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,6 +2976,8 @@ public function testNth($collection)
29762976
$this->assertEquals(['b', 'f'], $data->nth(4, 1)->all());
29772977
$this->assertEquals(['c'], $data->nth(4, 2)->all());
29782978
$this->assertEquals(['d'], $data->nth(4, 3)->all());
2979+
$this->assertEquals(['c', 'e'], $data->nth(2, 2)->all());
2980+
$this->assertEquals(['c', 'd', 'e', 'f'], $data->nth(1, 2)->all());
29792981
}
29802982

29812983
/**

0 commit comments

Comments
 (0)