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

when registering a function, their arguments can be dynamically #2462

Closed
wants to merge 3 commits into from
Closed

when registering a function, their arguments can be dynamically #2462

wants to merge 3 commits into from

Conversation

devnexen
Copy link
Member

@devnexen devnexen commented Apr 9, 2017

allocated when there is a typed return.

@devnexen
Copy link
Member Author

devnexen commented Apr 9, 2017

@nikic indeed you re right got double frees all the time.

Zend/zend_API.c Outdated
@@ -2473,6 +2475,12 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
fname_len = strlen(ptr->fname);
lowercase_name = zend_string_alloc(fname_len, 0);
zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len);
reg_function = zend_hash_find_ptr(target_function_table, lowercase_name);
if (reg_function->common.arg_info &&
Copy link
Member

Choose a reason for hiding this comment

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

This should also have a reg_function && chechk, because zend_unregister_functions is also called in error cases where not all functions have been defined, for example: https://github.com/devnexen/php-src/blob/f3ee93de6574c479515519c4e49271777f383264/Zend/zend_API.c#L2236

@nikic nikic added the Bug label Apr 9, 2017
@nikic
Copy link
Member

nikic commented Apr 9, 2017

Hmm, unfortunately this doesn't fix the leak completely: class methods aren't explicitly unregistered (instead the function table is simply destroyed), so those are still leaking.

@krakjoe
Copy link
Member

krakjoe commented Apr 17, 2017

What's the plan here ? Seems like it needs more work or another approach ?

@nikic
Copy link
Member

nikic commented Apr 17, 2017

Yeah, I'm not totally sure what the best way to fix this is. Maybe creating the functions with a FREE_ARGINFO flag, and dropping that flag in function copying might work.

@devnexen
Copy link
Member Author

do you think at least merging this would suffice for function part and making separated PR for classes would be good enough ?

@krakjoe
Copy link
Member

krakjoe commented Jul 10, 2017

I'm going to close this one as it's quite clear we need a different and complete approach that solves the problem in general.

Sorry it took so long ...

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.

None yet

3 participants