Skip to content

Commit fad3e5f

Browse files
committed
fix conflicts
2 parents aa4e269 + cd1ab41 commit fad3e5f

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function whereKey($id)
193193
return $this;
194194
}
195195

196-
if ($this->model->getKeyType() === 'string') {
196+
if ($id !== null && $this->model->getKeyType() === 'string') {
197197
$id = (string) $id;
198198
}
199199

@@ -214,7 +214,7 @@ public function whereKeyNot($id)
214214
return $this;
215215
}
216216

217-
if ($this->model->getKeyType() === 'string') {
217+
if ($id !== null && $this->model->getKeyType() === 'string') {
218218
$id = (string) $id;
219219
}
220220

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
3333
*
3434
* @var string
3535
*/
36-
const VERSION = '7.26.0';
36+
const VERSION = '7.26.1';
3737

3838
/**
3939
* The base path for the Laravel installation.

tests/Database/DatabaseEloquentBuilderTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,19 @@ public function testWhereKeyMethodWithStringZero()
10631063
$builder->whereKey($int);
10641064
}
10651065

1066+
public function testWhereKeyMethodWithStringNull()
1067+
{
1068+
$model = new EloquentBuilderTestStubStringPrimaryKey();
1069+
$builder = $this->getBuilder()->setModel($model);
1070+
$keyName = $model->getQualifiedKeyName();
1071+
1072+
$builder->getQuery()->shouldReceive('where')->once()->with($keyName, '=', m::on(function ($argument) {
1073+
return $argument === null;
1074+
}));
1075+
1076+
$builder->whereKey(null);
1077+
}
1078+
10661079
public function testWhereKeyMethodWithArray()
10671080
{
10681081
$model = $this->getMockModel();
@@ -1102,6 +1115,19 @@ public function testWhereKeyNotMethodWithStringZero()
11021115
$builder->whereKeyNot($int);
11031116
}
11041117

1118+
public function testWhereKeyNotMethodWithStringNull()
1119+
{
1120+
$model = new EloquentBuilderTestStubStringPrimaryKey();
1121+
$builder = $this->getBuilder()->setModel($model);
1122+
$keyName = $model->getQualifiedKeyName();
1123+
1124+
$builder->getQuery()->shouldReceive('where')->once()->with($keyName, '!=', m::on(function ($argument) {
1125+
return $argument === null;
1126+
}));
1127+
1128+
$builder->whereKeyNot(null);
1129+
}
1130+
11051131
public function testWhereKeyNotMethodWithInt()
11061132
{
11071133
$model = $this->getMockModel();

0 commit comments

Comments
 (0)