Skip to content

zend_enum: Rename try parameter to avoid conflict with C++ #15259

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Zend/zend_enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static ZEND_NAMED_FUNCTION(zend_enum_cases_func)
} ZEND_HASH_FOREACH_END();
}

ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_class_entry *ce, zend_long long_key, zend_string *string_key, bool try)
ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_class_entry *ce, zend_long long_key, zend_string *string_key, bool try_from)
{
if (ce->type == ZEND_USER_CLASS && !(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
if (zend_update_class_constants(ce) == FAILURE) {
Expand All @@ -303,7 +303,7 @@ ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_clas

if (case_name_zv == NULL) {
not_found:
if (try) {
if (try_from) {
*result = NULL;
return SUCCESS;
}
Expand Down Expand Up @@ -333,7 +333,7 @@ ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_clas
return SUCCESS;
}

static void zend_enum_from_base(INTERNAL_FUNCTION_PARAMETERS, bool try)
static void zend_enum_from_base(INTERNAL_FUNCTION_PARAMETERS, bool try_from)
{
zend_class_entry *ce = execute_data->func->common.scope;
bool release_string = false;
Expand Down Expand Up @@ -368,12 +368,12 @@ static void zend_enum_from_base(INTERNAL_FUNCTION_PARAMETERS, bool try)
}

zend_object *case_obj;
if (zend_enum_get_case_by_value(&case_obj, ce, long_key, string_key, try) == FAILURE) {
if (zend_enum_get_case_by_value(&case_obj, ce, long_key, string_key, try_from) == FAILURE) {
goto throw;
}

if (case_obj == NULL) {
ZEND_ASSERT(try);
ZEND_ASSERT(try_from);
goto return_null;
}

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ZEND_API void zend_enum_add_case(zend_class_entry *ce, zend_string *case_name, z
ZEND_API void zend_enum_add_case_cstr(zend_class_entry *ce, const char *name, zval *value);
ZEND_API zend_object *zend_enum_get_case(zend_class_entry *ce, zend_string *name);
ZEND_API zend_object *zend_enum_get_case_cstr(zend_class_entry *ce, const char *name);
ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_class_entry *ce, zend_long long_key, zend_string *string_key, bool try);
ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_class_entry *ce, zend_long long_key, zend_string *string_key, bool try_from);

static zend_always_inline zval *zend_enum_fetch_case_name(zend_object *zobj)
{
Expand Down
Loading