Skip to content

Commit c05390b

Browse files
committed
fix conflicts
2 parents 57d148d + 006873d commit c05390b

File tree

5 files changed

+77
-27
lines changed

5 files changed

+77
-27
lines changed

CHANGELOG-6.x.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# Release Notes for 6.x
22

3-
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.10...6.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.13...6.x)
4+
5+
6+
## [v6.20.13 (2021-01-19)](https://github.com/laravel/framework/compare/v6.20.12...v6.20.13)
7+
8+
### Fixed
9+
- Fixed empty html mail ([#35941](https://github.com/laravel/framework/pull/35941))
10+
11+
12+
## [v6.20.12 (2021-01-13)](https://github.com/laravel/framework/compare/v6.20.11...v6.20.12)
13+
14+
15+
## [v6.20.11 (2021-01-13)](https://github.com/laravel/framework/compare/v6.20.10...v6.20.11)
16+
17+
### Fixed
18+
- Limit expected bindings ([#35865](https://github.com/laravel/framework/pull/35865))
419

520

621
## [v6.20.10 (2021-01-12)](https://github.com/laravel/framework/compare/v6.20.9...v6.20.10)

src/Illuminate/Database/Query/Builder.php

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
709709
);
710710

711711
if (! $value instanceof Expression) {
712-
$this->addBinding(is_array($value) ? head($value) : $value, 'where');
712+
$this->addBinding($this->flattenValue($value), 'where');
713713
}
714714

715715
return $this;
@@ -1078,7 +1078,7 @@ public function whereBetween($column, array $values, $boolean = 'and', $not = fa
10781078

10791079
$this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');
10801080

1081-
$this->addBinding(array_slice($this->cleanBindings($values), 0, 2), 'where');
1081+
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');
10821082

10831083
return $this;
10841084
}
@@ -1201,7 +1201,7 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
12011201
$value, $operator, func_num_args() === 2
12021202
);
12031203

1204-
$value = is_array($value) ? head($value) : $value;
1204+
$value = $this->flattenValue($value);
12051205

12061206
if ($value instanceof DateTimeInterface) {
12071207
$value = $value->format('Y-m-d');
@@ -1242,7 +1242,7 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
12421242
$value, $operator, func_num_args() === 2
12431243
);
12441244

1245-
$value = is_array($value) ? head($value) : $value;
1245+
$value = $this->flattenValue($value);
12461246

12471247
if ($value instanceof DateTimeInterface) {
12481248
$value = $value->format('H:i:s');
@@ -1283,7 +1283,7 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
12831283
$value, $operator, func_num_args() === 2
12841284
);
12851285

1286-
$value = is_array($value) ? head($value) : $value;
1286+
$value = $this->flattenValue($value);
12871287

12881288
if ($value instanceof DateTimeInterface) {
12891289
$value = $value->format('d');
@@ -1328,7 +1328,7 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
13281328
$value, $operator, func_num_args() === 2
13291329
);
13301330

1331-
$value = is_array($value) ? head($value) : $value;
1331+
$value = $this->flattenValue($value);
13321332

13331333
if ($value instanceof DateTimeInterface) {
13341334
$value = $value->format('m');
@@ -1373,7 +1373,7 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
13731373
$value, $operator, func_num_args() === 2
13741374
);
13751375

1376-
$value = is_array($value) ? head($value) : $value;
1376+
$value = $this->flattenValue($value);
13771377

13781378
if ($value instanceof DateTimeInterface) {
13791379
$value = $value->format('Y');
@@ -1683,7 +1683,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
16831683
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
16841684

16851685
if (! $value instanceof Expression) {
1686-
$this->addBinding((int) $value);
1686+
$this->addBinding((int) $this->flattenValue($value));
16871687
}
16881688

16891689
return $this;
@@ -1832,7 +1832,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
18321832
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
18331833

18341834
if (! $value instanceof Expression) {
1835-
$this->addBinding(is_array($value) ? head($value) : $value, 'having');
1835+
$this->addBinding($this->flattenValue($value), 'having');
18361836
}
18371837

18381838
return $this;
@@ -1870,7 +1870,7 @@ public function havingBetween($column, array $values, $boolean = 'and', $not = f
18701870

18711871
$this->havings[] = compact('type', 'column', 'values', 'boolean', 'not');
18721872

1873-
$this->addBinding($this->cleanBindings($values), 'having');
1873+
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having');
18741874

18751875
return $this;
18761876
}
@@ -3092,6 +3092,17 @@ protected function cleanBindings(array $bindings)
30923092
}));
30933093
}
30943094

3095+
/**
3096+
* Get a scalar type value from an unknown type of input.
3097+
*
3098+
* @param mixed $value
3099+
* @return mixed
3100+
*/
3101+
protected function flattenValue($value)
3102+
{
3103+
return is_array($value) ? head(Arr::flatten($value)) : $value;
3104+
}
3105+
30953106
/**
30963107
* Get the default key name of the table.
30973108
*

src/Illuminate/Http/Concerns/InteractsWithContentTypes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function matchesType($actual, $type)
3131
*/
3232
public function isJson()
3333
{
34-
return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']);
34+
return Str::contains($this->header('CONTENT_TYPE') ?? '', ['/json', '+json']);
3535
}
3636

3737
/**

src/Illuminate/Mail/Mailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ protected function parseView($view)
352352
protected function addContent($message, $view, $plain, $raw, $data)
353353
{
354354
if (isset($view)) {
355-
$message->setBody($this->renderView($view, $data), 'text/html');
355+
$message->setBody($this->renderView($view, $data) ?: ' ', 'text/html');
356356
}
357357

358358
if (isset($plain)) {

tests/Database/DatabaseQueryBuilderTest.php

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -305,20 +305,25 @@ public function testWheresWithArrayValue()
305305
$this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
306306
$this->assertEquals([0 => 12], $builder->getBindings());
307307

308-
// $builder = $this->getBuilder();
309-
// $builder->select('*')->from('users')->where('id', '=', [12, 30]);
310-
// $this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
311-
// $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
308+
$builder = $this->getBuilder();
309+
$builder->select('*')->from('users')->where('id', '=', [12, 30]);
310+
$this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
311+
$this->assertEquals([0 => 12], $builder->getBindings());
312312

313-
// $builder = $this->getBuilder();
314-
// $builder->select('*')->from('users')->where('id', '!=', [12, 30]);
315-
// $this->assertSame('select * from "users" where "id" != ?', $builder->toSql());
316-
// $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
313+
$builder = $this->getBuilder();
314+
$builder->select('*')->from('users')->where('id', '!=', [12, 30]);
315+
$this->assertSame('select * from "users" where "id" != ?', $builder->toSql());
316+
$this->assertEquals([0 => 12], $builder->getBindings());
317317

318-
// $builder = $this->getBuilder();
319-
// $builder->select('*')->from('users')->where('id', '<>', [12, 30]);
320-
// $this->assertSame('select * from "users" where "id" <> ?', $builder->toSql());
321-
// $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
318+
$builder = $this->getBuilder();
319+
$builder->select('*')->from('users')->where('id', '<>', [12, 30]);
320+
$this->assertSame('select * from "users" where "id" <> ?', $builder->toSql());
321+
$this->assertEquals([0 => 12], $builder->getBindings());
322+
323+
$builder = $this->getBuilder();
324+
$builder->select('*')->from('users')->where('id', '=', [[12, 30]]);
325+
$this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
326+
$this->assertEquals([0 => 12], $builder->getBindings());
322327
}
323328

324329
public function testMySqlWrappingProtectsQuotationMarks()
@@ -649,6 +654,16 @@ public function testWhereBetweens()
649654
$this->assertSame('select * from "users" where "id" between ? and ?', $builder->toSql());
650655
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
651656

657+
$builder = $this->getBuilder();
658+
$builder->select('*')->from('users')->whereBetween('id', [[1, 2, 3]]);
659+
$this->assertSame('select * from "users" where "id" between ? and ?', $builder->toSql());
660+
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
661+
662+
$builder = $this->getBuilder();
663+
$builder->select('*')->from('users')->whereBetween('id', [[1], [2, 3]]);
664+
$this->assertSame('select * from "users" where "id" between ? and ?', $builder->toSql());
665+
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
666+
652667
$builder = $this->getBuilder();
653668
$builder->select('*')->from('users')->whereNotBetween('id', [1, 2]);
654669
$this->assertSame('select * from "users" where "id" not between ? and ?', $builder->toSql());
@@ -1244,10 +1259,19 @@ public function testHavings()
12441259
$builder = $this->getBuilder();
12451260
$builder->select(['category', new Raw('count(*) as "total"')])->from('item')->where('department', '=', 'popular')->groupBy('category')->having('total', '>', 3);
12461261
$this->assertSame('select "category", count(*) as "total" from "item" where "department" = ? group by "category" having "total" > ?', $builder->toSql());
1262+
}
1263+
1264+
public function testHavingBetweens()
1265+
{
1266+
$builder = $this->getBuilder();
1267+
$builder->select('*')->from('users')->havingBetween('id', [1, 2, 3]);
1268+
$this->assertSame('select * from "users" having "id" between ? and ?', $builder->toSql());
1269+
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
12471270

12481271
$builder = $this->getBuilder();
1249-
$builder->select('*')->from('users')->havingBetween('last_login_date', ['2018-11-16', '2018-12-16']);
1250-
$this->assertSame('select * from "users" having "last_login_date" between ? and ?', $builder->toSql());
1272+
$builder->select('*')->from('users')->havingBetween('id', [[1, 2], [3, 4]]);
1273+
$this->assertSame('select * from "users" having "id" between ? and ?', $builder->toSql());
1274+
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
12511275
}
12521276

12531277
public function testHavingShortcut()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy