From be52cdca1c0a550757a1ef6b9f05805cb8252242 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 9 Feb 2015 10:34:00 +0100 Subject: [PATCH] check for non-persistent key --- php_raphf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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 -- 2.30.2