Skip to content

Commit 2584678

Browse files
committed
fix conflicts
2 parents bd490fe + 784f8ff commit 2584678

File tree

4 files changed

+73
-5
lines changed

4 files changed

+73
-5
lines changed

CHANGELOG-6.x.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@
259259
### Changed
260260
- Improve cookie encryption ([#33662](https://github.com/laravel/framework/pull/33662))
261261

262+
This change will invalidate all existing cookies. Please see [this security bulletin](https://blog.laravel.com/laravel-cookie-security-releases) for more information.
263+
262264

263265
## [v6.18.26 (2020-07-21)](https://github.com/laravel/framework/compare/v6.18.25...v6.18.26)
264266

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 = '8.31.0';
36+
const VERSION = '8.32.0';
3737

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

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ public function validateRequiredIf($attribute, $value, $parameters)
14271427

14281428
[$values, $other] = $this->parseDependentRuleParameters($parameters);
14291429

1430-
if (in_array($other, $values)) {
1430+
if (in_array($other, $values, is_bool($other))) {
14311431
return $this->validateRequired($attribute, $value);
14321432
}
14331433

@@ -1490,7 +1490,7 @@ public function validateExcludeIf($attribute, $value, $parameters)
14901490

14911491
[$values, $other] = $this->parseDependentRuleParameters($parameters);
14921492

1493-
return ! in_array($other, $values);
1493+
return ! in_array($other, $values, is_bool($other));
14941494
}
14951495

14961496
/**
@@ -1507,7 +1507,7 @@ public function validateExcludeUnless($attribute, $value, $parameters)
15071507

15081508
[$values, $other] = $this->parseDependentRuleParameters($parameters);
15091509

1510-
return in_array($other, $values);
1510+
return in_array($other, $values, is_bool($other));
15111511
}
15121512

15131513
/**
@@ -1596,7 +1596,7 @@ public function validateRequiredUnless($attribute, $value, $parameters)
15961596

15971597
[$values, $other] = $this->parseDependentRuleParameters($parameters);
15981598

1599-
if (! in_array($other, $values)) {
1599+
if (! in_array($other, $values, is_bool($other))) {
16001600
return $this->validateRequired($attribute, $value);
16011601
}
16021602

tests/Validation/ValidationValidatorTest.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,34 @@ public function testRequiredIf()
10961096
$v = new Validator($trans, ['foo' => true], ['bar' => 'required_if:foo,false']);
10971097
$this->assertTrue($v->passes());
10981098

1099+
$trans = $this->getIlluminateArrayTranslator();
1100+
$v = new Validator($trans, ['foo' => true], ['bar' => 'required_if:foo,null']);
1101+
$this->assertTrue($v->passes());
1102+
1103+
$trans = $this->getIlluminateArrayTranslator();
1104+
$v = new Validator($trans, ['foo' => 0], ['bar' => 'required_if:foo,0']);
1105+
$this->assertTrue($v->fails());
1106+
1107+
$trans = $this->getIlluminateArrayTranslator();
1108+
$v = new Validator($trans, ['foo' => '0'], ['bar' => 'required_if:foo,0']);
1109+
$this->assertTrue($v->fails());
1110+
1111+
$trans = $this->getIlluminateArrayTranslator();
1112+
$v = new Validator($trans, ['foo' => 1], ['bar' => 'required_if:foo,1']);
1113+
$this->assertTrue($v->fails());
1114+
1115+
$trans = $this->getIlluminateArrayTranslator();
1116+
$v = new Validator($trans, ['foo' => '1'], ['bar' => 'required_if:foo,1']);
1117+
$this->assertTrue($v->fails());
1118+
10991119
$trans = $this->getIlluminateArrayTranslator();
11001120
$v = new Validator($trans, ['foo' => true], ['bar' => 'required_if:foo,true']);
11011121
$this->assertTrue($v->fails());
11021122

1123+
$trans = $this->getIlluminateArrayTranslator();
1124+
$v = new Validator($trans, ['foo' => false], ['bar' => 'required_if:foo,false']);
1125+
$this->assertTrue($v->fails());
1126+
11031127
// error message when passed multiple values (required_if:foo,bar,baz)
11041128
$trans = $this->getIlluminateArrayTranslator();
11051129
$trans->addLines(['validation.required_if' => 'The :attribute field is required when :other is :value.'], 'en');
@@ -1138,6 +1162,26 @@ public function testRequiredUnless()
11381162
$v = new Validator($trans, ['foo' => false], ['bar' => 'required_unless:foo,true']);
11391163
$this->assertTrue($v->fails());
11401164

1165+
$trans = $this->getIlluminateArrayTranslator();
1166+
$v = new Validator($trans, ['foo' => true], ['bar' => 'required_unless:foo,null']);
1167+
$this->assertTrue($v->fails());
1168+
1169+
$trans = $this->getIlluminateArrayTranslator();
1170+
$v = new Validator($trans, ['foo' => '0'], ['bar' => 'required_unless:foo,0']);
1171+
$this->assertTrue($v->passes());
1172+
1173+
$trans = $this->getIlluminateArrayTranslator();
1174+
$v = new Validator($trans, ['foo' => 0], ['bar' => 'required_unless:foo,0']);
1175+
$this->assertTrue($v->passes());
1176+
1177+
$trans = $this->getIlluminateArrayTranslator();
1178+
$v = new Validator($trans, ['foo' => '1'], ['bar' => 'required_unless:foo,1']);
1179+
$this->assertTrue($v->passes());
1180+
1181+
$trans = $this->getIlluminateArrayTranslator();
1182+
$v = new Validator($trans, ['foo' => 1], ['bar' => 'required_unless:foo,1']);
1183+
$this->assertTrue($v->passes());
1184+
11411185
// error message when passed multiple values (required_unless:foo,bar,baz)
11421186
$trans = $this->getIlluminateArrayTranslator();
11431187
$trans->addLines(['validation.required_unless' => 'The :attribute field is required unless :other is in :values.'], 'en');
@@ -5406,6 +5450,20 @@ public function providesPassingExcludeIfData()
54065450
'has_appointment' => false,
54075451
],
54085452
],
5453+
[
5454+
[
5455+
'has_appointment' => ['nullable', 'bool'],
5456+
'appointment_date' => ['exclude_if:has_appointment,null', 'required', 'date'],
5457+
],
5458+
[
5459+
'has_appointment' => true,
5460+
'appointment_date' => '2021-03-08',
5461+
],
5462+
[
5463+
'has_appointment' => true,
5464+
'appointment_date' => '2021-03-08',
5465+
],
5466+
],
54095467
[
54105468
[
54115469
'has_appointment' => ['required', 'bool'],
@@ -5740,6 +5798,14 @@ public function testExcludeUnless()
57405798
);
57415799
$this->assertTrue($validator->fails());
57425800
$this->assertSame(['mouse' => ['validation.required']], $validator->messages()->toArray());
5801+
5802+
$validator = new Validator(
5803+
$this->getIlluminateArrayTranslator(),
5804+
['foo' => true, 'bar' => 'baz'],
5805+
['foo' => 'nullable', 'bar' => 'exclude_unless:foo,null']
5806+
);
5807+
$this->assertTrue($validator->passes());
5808+
$this->assertSame(['foo' => true], $validator->validated());
57435809
}
57445810

57455811
public function testExcludeWithout()

0 commit comments

Comments
 (0)