Skip to content

PHPC-1073: Remove superfluous calls to php_array_exists #1029

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 2 commits into from
Oct 18, 2019

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Oct 2, 2019

@alcaeus alcaeus requested a review from jmikola October 2, 2019 12:53
@alcaeus alcaeus self-assigned this Oct 2, 2019
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

LGTM if my understanding of the one question was correct.

upsert = php_array_fetchc_bool(zoptions, "upsert");
}
multi = php_array_fetchc_bool(zoptions, "multi");
upsert = php_array_fetchc_bool(zoptions, "upsert");
Copy link
Member

Choose a reason for hiding this comment

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

PHPC-1073 mentions that bool fetching might still want "exists" checks, but I assume this is fine since both default to false already, correct?

Likewise for any bool fetches later on in this PR where false corresponds to the default case.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is correct. Looking at php_array_fetchc_bool, it returns false if the option isn't given. Since these two are false by default, we don't need to check for the existence of it. When we have a bool that is true by default, we need to check for existence first so we can default to true.

alcaeus added a commit that referenced this pull request Oct 18, 2019
@alcaeus alcaeus merged commit 0d767a7 into mongodb:master Oct 18, 2019
@alcaeus alcaeus deleted the phpc-1073 branch October 18, 2019 13:22
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