Skip to content

check that properties is an array before accessing #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2018
Merged

check that properties is an array before accessing #197

merged 3 commits into from
Aug 23, 2018

Conversation

aaronpk
Copy link
Member

@aaronpk aaronpk commented Aug 23, 2018

fixes #196

@aaronpk aaronpk requested a review from gRegorLove August 23, 2018 19:36

$output = Mf2\parse($input);
$this->assertEquals([], $output['items'][0]['properties']['comment'][0]['properties']);
$this->assertEquals([], $output['items'][0]['properties']['comment'][0]['children'][0]['properties']);
Copy link
Member

Choose a reason for hiding this comment

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

Minor update: can use assertEmpty() for these.

Copy link
Member Author

Choose a reason for hiding this comment

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

what does assertEmpty do if the value is null or not an array? I want to ensure that properties exists and is an array with no items.

Copy link
Member

Choose a reason for hiding this comment

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

I think null value would pass the assertion; not sure about an empty object. assertInternalType can be used to verify it's an array.

Copy link
Member

@gRegorLove gRegorLove left a comment

Choose a reason for hiding this comment

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

Looks good once the conflict is resolved. Left an inline comment re: assertEmpty

@aaronpk aaronpk merged commit 8247a27 into microformats:master Aug 23, 2018
@aaronpk aaronpk deleted the issue-196 branch August 23, 2018 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants