From: Michael Wallner Date: Mon, 9 Feb 2015 09:34:00 +0000 (+0100) Subject: check for non-persistent key X-Git-Tag: release-2.0.0RC1~21 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-raphf;a=commitdiff_plain;h=be52cdca1c0a550757a1ef6b9f05805cb8252242 check for non-persistent key --- diff --git a/php_raphf.c b/php_raphf.c index 1e4276b..a62897d 100644 --- a/php_raphf.c +++ b/php_raphf.c @@ -243,10 +243,21 @@ static inline php_persistent_handle_list_t *php_persistent_handle_list_find( } if ((list = php_persistent_handle_list_init(NULL))) { - zval p; + zval p, *rv; + zend_string *id; ZVAL_PTR(&p, list); - if (zend_symtable_update(&provider->list.free, ident, &p)) { + if ((GC_FLAGS(ident) & IS_STR_PERSISTENT)) { + id = ident; + } else { + ident = zend_string_dup(ident, 1); + } + rv = zend_symtable_update(&provider->list.free, ident, &p); + if (id != ident) { + zend_string_release(id); + } + + if (rv) { #if PHP_RAPHF_DEBUG_PHANDLES fprintf(stderr, "LSTFIND: %p (new)\n", list); #endif