Skip to content

[5.6] Return null if object property is undefined#23267

Merged
taylorotwell merged 2 commits intolaravel:5.6from
tillkruss:optional
Feb 23, 2018
Merged

[5.6] Return null if object property is undefined#23267
taylorotwell merged 2 commits intolaravel:5.6from
tillkruss:optional

Conversation

@tillkruss
Copy link
Copy Markdown
Contributor

I just ran into this issue:

$data = (object) ['foo' => 'bar'];

optional($data)->foobar // Undefined property: stdClass::$foobar

I'm not sure if that's intended, but I expected it to return null if it's an object, but the property doesn't exist.

@taylorotwell taylorotwell merged commit 5acb717 into laravel:5.6 Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants