check for non-persistent key
authorMichael Wallner <mike@php.net>
Mon, 9 Feb 2015 09:34:00 +0000 (10:34 +0100)
committerMichael Wallner <mike@php.net>
Mon, 9 Feb 2015 09:34:00 +0000 (10:34 +0100)
php_raphf.c

index 1e4276bd6f78483565c3464e8f4db0c34a442f5f..a62897da8b6ee7ed7beb4d856903df90a2ff2f07 100644 (file)
@@ -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