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

Fix build errors for PHP < 8.0 #149

Merged
merged 1 commit into from
Aug 18, 2023
Merged
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
6 changes: 6 additions & 0 deletions sapnwrfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,11 @@ PHP_METHOD(Connection, getFunction)

// add a 'name' property to the function object. this helps to identify the object
// when dumping it with var_dump()
#if PHP_VERSION_ID >= 80000
zend_update_property_str(sapnwrfc_function_ce, Z_OBJ_P(return_value), "name", sizeof("name")-1, zend_string_copy(function_name));
#else
add_property_str(return_value, "name", zend_string_copy(function_name));
#endif

// get nr of parameters
rc = RfcGetParameterCount(func_intern->function_desc_handle, &func_intern->parameter_count, &error_info);
Expand Down Expand Up @@ -1055,11 +1059,13 @@ static void register_sapnwrfc_function_object()
sapnwrfc_function_ce = zend_register_internal_class(&ce);
sapnwrfc_function_ce->ce_flags |= ZEND_ACC_FINAL;

#if PHP_VERSION_ID >= 80000
zval property_name_default_value;
ZVAL_EMPTY_STRING(&property_name_default_value);
zend_string *property_name_name = zend_string_init("name", sizeof("name") - 1, 1);
zend_declare_typed_property(sapnwrfc_function_ce, property_name_name, &property_name_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
zend_string_release(property_name_name);
#endif
}

unsigned int rfc_clear_function_desc_cache(zend_string *function_name, zend_string *repository_id)
Expand Down