1
0
mirror of https://github.com/php/php-src.git synced 2026-04-04 22:52:40 +02:00

* Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead

of zval *, and it wasn't using reference counting)
* Fix a memory leak in static array()'s with textual indices
This commit is contained in:
Zeev Suraski
1999-06-22 19:05:40 +00:00
parent 31c8ec4c80
commit 3eac45ea80
3 changed files with 4 additions and 3 deletions

View 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: ");
}

View 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);

View 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);