Skip to content
Snippets Groups Projects
Commit 7196f752 authored by Robin Gustafsson's avatar Robin Gustafsson
Browse files

New upstream version 6.20.14+dfsg

parent 63afe1e6
No related branches found
No related tags found
No related merge requests found
Pipeline #222158 canceled
# Release Notes for 6.x
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.10...6.x)
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.13...6.x)
## [v6.20.13 (2021-01-19)](https://github.com/laravel/framework/compare/v6.20.12...v6.20.13)
### Fixed
- Fixed empty html mail ([#35941](https://github.com/laravel/framework/pull/35941))
## [v6.20.12 (2021-01-13)](https://github.com/laravel/framework/compare/v6.20.11...v6.20.12)
## [v6.20.11 (2021-01-13)](https://github.com/laravel/framework/compare/v6.20.10...v6.20.11)
### Fixed
- Limit expected bindings ([#35865](https://github.com/laravel/framework/pull/35865))
## [v6.20.10 (2021-01-12)](https://github.com/laravel/framework/compare/v6.20.9...v6.20.10)
......
......@@ -698,7 +698,7 @@ class Builder
);
if (! $value instanceof Expression) {
$this->addBinding(is_array($value) ? head($value) : $value, 'where');
$this->addBinding($this->flattenValue($value), 'where');
}
return $this;
......@@ -1043,7 +1043,7 @@ class Builder
$this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');
$this->addBinding(array_slice($this->cleanBindings($values), 0, 2), 'where');
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');
return $this;
}
......@@ -1111,7 +1111,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
$value = is_array($value) ? head($value) : $value;
$value = $this->flattenValue($value);
if ($value instanceof DateTimeInterface) {
$value = $value->format('Y-m-d');
......@@ -1152,7 +1152,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
$value = is_array($value) ? head($value) : $value;
$value = $this->flattenValue($value);
if ($value instanceof DateTimeInterface) {
$value = $value->format('H:i:s');
......@@ -1193,7 +1193,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
$value = is_array($value) ? head($value) : $value;
$value = $this->flattenValue($value);
if ($value instanceof DateTimeInterface) {
$value = $value->format('d');
......@@ -1238,7 +1238,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
$value = is_array($value) ? head($value) : $value;
$value = $this->flattenValue($value);
if ($value instanceof DateTimeInterface) {
$value = $value->format('m');
......@@ -1283,7 +1283,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
$value = is_array($value) ? head($value) : $value;
$value = $this->flattenValue($value);
if ($value instanceof DateTimeInterface) {
$value = $value->format('Y');
......@@ -1593,7 +1593,7 @@ class Builder
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
if (! $value instanceof Expression) {
$this->addBinding((int) $value);
$this->addBinding((int) $this->flattenValue($value));
}
return $this;
......@@ -1742,7 +1742,7 @@ class Builder
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
if (! $value instanceof Expression) {
$this->addBinding(is_array($value) ? head($value) : $value, 'having');
$this->addBinding($this->flattenValue($value), 'having');
}
return $this;
......@@ -1780,7 +1780,7 @@ class Builder
$this->havings[] = compact('type', 'column', 'values', 'boolean', 'not');
$this->addBinding($this->cleanBindings($values), 'having');
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having');
return $this;
}
......@@ -2958,6 +2958,17 @@ class Builder
}));
}
/**
* Get a scalar type value from an unknown type of input.
*
* @param mixed $value
* @return mixed
*/
protected function flattenValue($value)
{
return is_array($value) ? head(Arr::flatten($value)) : $value;
}
/**
* Get the default key name of the table.
*
......
......@@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '6.20.11';
const VERSION = '6.20.14';
/**
* The base path for the Laravel installation.
......
......@@ -31,7 +31,7 @@ trait InteractsWithContentTypes
*/
public function isJson()
{
return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']);
return Str::contains($this->header('CONTENT_TYPE') ?? '', ['/json', '+json']);
}
/**
......
......@@ -325,7 +325,7 @@ class Mailer implements MailerContract, MailQueueContract
protected function addContent($message, $view, $plain, $raw, $data)
{
if (isset($view)) {
$message->setBody($this->renderView($view, $data), 'text/html');
$message->setBody($this->renderView($view, $data) ?: ' ', 'text/html');
}
if (isset($plain)) {
......
......@@ -305,20 +305,25 @@ class DatabaseQueryBuilderTest extends TestCase
$this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
$this->assertEquals([0 => 12], $builder->getBindings());
// $builder = $this->getBuilder();
// $builder->select('*')->from('users')->where('id', '=', [12, 30]);
// $this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
// $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->where('id', '=', [12, 30]);
$this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
$this->assertEquals([0 => 12], $builder->getBindings());
// $builder = $this->getBuilder();
// $builder->select('*')->from('users')->where('id', '!=', [12, 30]);
// $this->assertSame('select * from "users" where "id" != ?', $builder->toSql());
// $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->where('id', '!=', [12, 30]);
$this->assertSame('select * from "users" where "id" != ?', $builder->toSql());
$this->assertEquals([0 => 12], $builder->getBindings());
// $builder = $this->getBuilder();
// $builder->select('*')->from('users')->where('id', '<>', [12, 30]);
// $this->assertSame('select * from "users" where "id" <> ?', $builder->toSql());
// $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->where('id', '<>', [12, 30]);
$this->assertSame('select * from "users" where "id" <> ?', $builder->toSql());
$this->assertEquals([0 => 12], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->where('id', '=', [[12, 30]]);
$this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
$this->assertEquals([0 => 12], $builder->getBindings());
}
public function testMySqlWrappingProtectsQuotationMarks()
......@@ -649,6 +654,16 @@ class DatabaseQueryBuilderTest extends TestCase
$this->assertSame('select * from "users" where "id" between ? and ?', $builder->toSql());
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->whereBetween('id', [[1, 2, 3]]);
$this->assertSame('select * from "users" where "id" between ? and ?', $builder->toSql());
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->whereBetween('id', [[1], [2, 3]]);
$this->assertSame('select * from "users" where "id" between ? and ?', $builder->toSql());
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->whereNotBetween('id', [1, 2]);
$this->assertSame('select * from "users" where "id" not between ? and ?', $builder->toSql());
......@@ -1167,10 +1182,19 @@ class DatabaseQueryBuilderTest extends TestCase
$builder = $this->getBuilder();
$builder->select(['category', new Raw('count(*) as "total"')])->from('item')->where('department', '=', 'popular')->groupBy('category')->having('total', '>', 3);
$this->assertSame('select "category", count(*) as "total" from "item" where "department" = ? group by "category" having "total" > ?', $builder->toSql());
}
public function testHavingBetweens()
{
$builder = $this->getBuilder();
$builder->select('*')->from('users')->havingBetween('id', [1, 2, 3]);
$this->assertSame('select * from "users" having "id" between ? and ?', $builder->toSql());
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->havingBetween('last_login_date', ['2018-11-16', '2018-12-16']);
$this->assertSame('select * from "users" having "last_login_date" between ? and ?', $builder->toSql());
$builder->select('*')->from('users')->havingBetween('id', [[1, 2], [3, 4]]);
$this->assertSame('select * from "users" having "id" between ? and ?', $builder->toSql());
$this->assertEquals([0 => 1, 1 => 2], $builder->getBindings());
}
public function testHavingShortcut()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment