Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Illuminate/Support/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ public static function get($array, $key, $default = null)
}

foreach (explode('.', $key) as $segment) {
if (static::accessible($array) && static::exists($array, $segment)) {
$array = $array[$segment];
} else {
return value($default);
if (!static::accessible($array) && !static::exists($array, $segment)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you made a mistake here. The code you are looking for is:

if (! static::accessible($array) ||  ! static::exists($array, $segment)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh... I missed to turn the and to an or!

return value($default);
}

$array = $array[$segment];
}

return $array;
Expand Down Expand Up @@ -335,11 +335,11 @@ public static function has($array, $keys)
}

foreach (explode('.', $key) as $segment) {
if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
$subKeyArray = $subKeyArray[$segment];
} else {
return false;
if (!static::accessible($subKeyArray) && !static::exists($subKeyArray, $segment)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you made a mistake here. The code you are looking for is:

if (! static::accessible($subKeyArray) || ! static::exists($subKeyArray, $segment)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh... I missed to turn the and to an or!

return false;
}

$subKeyArray = $subKeyArray[$segment];
}
}

Expand Down