Skip to content
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

RFC: array_find #14108

Merged
merged 15 commits into from
May 31, 2024
Merged

RFC: array_find #14108

merged 15 commits into from
May 31, 2024

Conversation

joshuaruesweg
Copy link
Member

@joshuaruesweg joshuaruesweg commented May 1, 2024

Copy link
Contributor

@morrisonlevi morrisonlevi left a comment

Choose a reason for hiding this comment

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

I took a quick look, have a few suggestions.

ext/standard/array.c Outdated Show resolved Hide resolved
ext/standard/array.c Outdated Show resolved Hide resolved
ext/standard/array.c Outdated Show resolved Hide resolved
ext/standard/tests/array/array_all_basic.phpt Outdated Show resolved Hide resolved
ext/standard/tests/array/array_all_basic.phpt Outdated Show resolved Hide resolved
ext/standard/tests/array/array_any_basic.phpt Outdated Show resolved Hide resolved
ext/standard/tests/array/array_find_basic.phpt Outdated Show resolved Hide resolved
ext/standard/tests/array/array_find_key_basic.phpt Outdated Show resolved Hide resolved
@@ -6581,6 +6581,165 @@ PHP_FUNCTION(array_filter)
}
/* }}} */

/* {{{ Internal function to find an array element for a user closure. */
static zend_result php_array_find(const HashTable *array, zend_fcall_info fci, zend_fcall_info_cache fci_cache, zval *result_key, zval *result_value, bool negate_condition)
Copy link
Contributor

Choose a reason for hiding this comment

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

Anyone have an objection to making this ZEND_API?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no disagreement. I have chosen a lower visibility for the time being, as it is always easier to increase visibility afterwards instead of reducing it. But if you see a more global use case for the method, we can make it ZEND_API.

Copy link
Member

Choose a reason for hiding this comment

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

I've now merged this as-is. The PHPAPI can be added in a follow-up commit if necessary/desired.

@nielsdos
Copy link
Member

@joshuaruesweg The build on master was briefly broken, a rebase will fix CI here. Sorry for that.

@joshuaruesweg joshuaruesweg requested a review from bukka as a code owner May 30, 2024 12:02
@TimWolla TimWolla merged commit e4a8d5b into php:master May 31, 2024
2 checks passed
@TimWolla
Copy link
Member

Now merged, thank you. Don't forget to adjust the RFC status to "Implemented" and to add the link to the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new method: array_find
4 participants