Skip to content

Use an non-interned zend_string for registerExtension on ZTS #255

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
Aug 13, 2016
Merged

Use an non-interned zend_string for registerExtension on ZTS #255

merged 2 commits into from
Aug 13, 2016

Conversation

TysonAndre
Copy link
Contributor

@TysonAndre TysonAndre commented Aug 12, 2016

(There are no interned strings in ZTS, see the definition of
zend_new_interned_string_int)

Fixes #247

See discussion in #254

On NTS, strings must be non-interned in order to last until module shutdown. If registerExtension is passed a literal string constant, it is probably(?) interned.
ZTS doesn't have any interned strings.

Only one test has been run with valgrind(tests/extensions_basic.phpt)

Valgrind checks for invalid memory accesses and memory leaks.

"-m" makes php unit tests use valgrind (and malloc instead of emalloc, etc.)
@TysonAndre TysonAndre changed the title Use an interned zend_string for registerExtension on ZTS Use an non-interned zend_string for registerExtension on ZTS Aug 12, 2016
@@ -270,6 +270,8 @@ static void v8js_jsext_free_storage(v8js_jsext *jsext) /* {{{ */
v8js_free_ext_strarr(jsext->deps, jsext->deps_count);
}
delete jsext->extension;
// jsext->name and jsext->source are interned, this would do nothing.
// Interned strings will be freed after module shutdown (On ZTS - But on NTS, they're actually interned)
Copy link
Member

Choose a reason for hiding this comment

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

I think this comment is (now) misleading/wrong, since the strings are guaranteed not to be interned

(There are no interned strings in ZTS, see the definition of
 zend_new_interned_string_int)

On NTS, strings must be non-interned in order to last until module shutdown.
interned strings are cleaned up before module shutdown.
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