You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 6, 2019. It is now read-only.
There are two problems when using Arrays::get($data, $path, $default);
Consider such input:
$data = [
'foo' => null,
];
When $key is a dot notation for a path that doesn't exist, $default is returned. By default, it'd be null. One can work around this problem as $default can be a Closure. Sth like Arrays::get($data, $path, function() { throw new \Exception('Item not found'); }); works but is just a workaround for another problem. Example: Arrays::get($data, 'foo.bar.baz'); returns null.
When $key exists but the value is null, it would be treated as not existing. Example: Arrays::get($data, 'foo', 'the value does not exist'); returns the value does not exist
Both problems stem from the fact of using isset() instead of array_key_exists(). It's trivial to fix the issue but it'd introduce BC breaks.