0
0
mirror of https://github.com/phpv8/v8js.git synced 2025-03-11 20:08:43 +00:00

Merge pull request #255 from TysonAndre/use-non-zend_string-v2

Use an non-interned zend_string for registerExtension on ZTS
This commit is contained in:
Stefan Siegl 2016-08-13 11:46:45 +02:00 committed by GitHub
commit 8625f70e2e
2 changed files with 10 additions and 3 deletions

View File

@ -8,7 +8,11 @@ php:
env:
- V8VER=5.2
- V8VER=5.1
- V8VER=5.2 VALGRIND=1
before_install: make -f Makefile.travis before_install
install: make -f Makefile.travis install
install:
- if [ "$VALGRIND" = 1 ]; then sudo apt-get install -qq valgrind; export TEST_PHP_ARGS="-m"; fi
- make -f Makefile.travis install
script: make -f Makefile.travis test

View File

@ -270,6 +270,7 @@ static void v8js_jsext_free_storage(v8js_jsext *jsext) /* {{{ */
v8js_free_ext_strarr(jsext->deps, jsext->deps_count);
}
delete jsext->extension;
// Free the persisted non-interned strings we allocated.
zend_string_release(jsext->name);
zend_string_release(jsext->source);
@ -955,8 +956,10 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval
}
jsext->auto_enable = auto_enable;
jsext->name = zend_string_dup(name, 1);
jsext->source = zend_string_dup(source, 1);
// Allocate a persistent string which will survive until module shutdown on both ZTS(Persistent) and NTS(Not interned, those would be cleaned up)
// (zend_string_dup would return the original interned string, if interned, so we don't use that)
jsext->name = zend_string_init(ZSTR_VAL(name), ZSTR_LEN(name), 1);
jsext->source = zend_string_init(ZSTR_VAL(source), ZSTR_LEN(source), 1);
if (jsext->deps) {
jsext->deps_ht = (HashTable *) malloc(sizeof(HashTable));