Skip to content

Commit

Permalink
Cookie/ParseTest: fix an incorrect condition
Browse files Browse the repository at this point in the history
As the `$expected_attributes` and `$expected_flags` variables are optional parameters, these will always be set. However, they may not be set to an array, which is what this condition should protect against.
  • Loading branch information
jrfnl committed Jul 8, 2024
1 parent 1c0f37e commit 289a2c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/Cookie/ParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,13 @@ private function check_parsed_cookie($cookie, $expected, $expected_attributes =
$this->assertSame($expected['expired'], $cookie->is_expired(), 'Cookie expiration identification does not match expectation');
}

if (isset($expected_attributes) && !empty($expected_attributes)) {
if (is_array($expected_attributes) && !empty($expected_attributes)) {
foreach ($expected_attributes as $attr_key => $attr_val) {
$this->assertSame($attr_val, $cookie->attributes[$attr_key], "Attribute '$attr_key' should match supplied value");
}
}

if (isset($expected_flags) && !empty($expected_flags)) {
if (is_array($expected_flags) && !empty($expected_flags)) {
foreach ($expected_flags as $flag_key => $flag_val) {
$this->assertSame($flag_val, $cookie->flags[$flag_key], "Flag '$flag_key' should match supplied value");
}
Expand Down

0 comments on commit 289a2c9

Please sign in to comment.