]> granicus.if.org Git - php/commitdiff
* Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead
authorZeev Suraski <zeev@php.net>
Tue, 22 Jun 1999 19:05:40 +0000 (19:05 +0000)
committerZeev Suraski <zeev@php.net>
Tue, 22 Jun 1999 19:05:40 +0000 (19:05 +0000)
  of zval *, and it wasn't using reference counting)
* Fix a memory leak in static array()'s with textual indices

Zend/zend_alloc.c
Zend/zend_compile.c
Zend/zend_operators.c

index e2d2a636887da4f77a7499b72cfe49751b5290ef..4911156c6d27ebca3b3959a2323e9074e0a4ecbc 100644 (file)
@@ -433,7 +433,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent, char *filename, int lineno)
        if (!silent) {
                zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
                zend_debug_alloc_output("---------------------------------------\n");
-               zend_debug_alloc_output("Block 0x%0.8lX status at %s:%d:\n", (long) p, filename, lineno);
+               zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n", filename, lineno, (long) p);
                zend_debug_alloc_output("%10s\t","Beginning:  ");
        }
 
index ec43dcdbdc39929b11cea5f3e6129cff3c338a6f..48601ca70f80d858f1a3cd4cc2169dffd2ab7b46 100644 (file)
@@ -1429,6 +1429,7 @@ void do_add_static_array_element(znode *result, znode *offset, znode *expr)
                switch (offset->u.constant.type) {
                        case IS_STRING:
                                zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
+                               zval_dtor(&offset->u.constant);
                                break;
                        case IS_LONG:
                                zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL);
index 9496edd5d234c343b509f7fa8ac11adf6bc8c880..4dc7d4c337ff6a71000842db5be13edf3a60202a 100644 (file)
@@ -390,11 +390,11 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2)
        zval op1_copy, op2_copy;
 
        if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
-               zval tmp;
+               zval *tmp;
                
                *result = *op1;
                zval_copy_ctor(result);
-               zend_hash_merge(result->value.ht,op2->value.ht,(void (*)(void *pData)) zval_copy_ctor, (void *) &tmp, sizeof(zval), 0);
+               zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
                return SUCCESS;
        }
        zendi_convert_scalar_to_number(op1, op1_copy);