com php-src: Fixed create_function(): Zend/zend_bui ltin_functions.c Zend/zend_execute_API.c
| From: | Dmitry Stogov | Date: | Mon, 24 Feb 2014 12:35:55 +0000 |
| Subject: | com php-src: Fixed create_function(): Zend/zend_bui ltin_functions.c Zend/zend_execute_API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77950@lists.php.net to get a copy of this message | ||
Commit: 789eb6dfc3aa524bf66c49b0677857baea90388a
Author: Dmitry Stogov <dmitry@zend.com> Mon, 24 Feb 2014 16:35:55 +0400
Parents: 595fc4d901cbb69d2d4fe46508b7303ac62428b8
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=789eb6dfc3aa524bf66c49b0677857baea90388a
Log:
Fixed create_function()
Changed paths:
M Zend/zend_builtin_functions.c
M Zend/zend_execute_API.c
Diff:
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index d421fd9..4595e52 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1772,22 +1772,22 @@ ZEND_FUNCTION(create_function)
efree(eval_name);
if (retval==SUCCESS) {
- zend_function *new_function, *func;
+ zend_op_array *new_function, *func;
func = zend_hash_str_find_ptr(EG(function_table), LAMBDA_TEMP_FUNCNAME,
sizeof(LAMBDA_TEMP_FUNCNAME)-1);
if (!func) {
zend_error(E_ERROR, "Unexpected inconsistency in create_function()");
RETURN_FALSE;
}
- new_function = pemalloc(sizeof(zend_function), func->type == ZEND_INTERNAL_FUNCTION);
- memcpy(new_function, func, sizeof(zend_function));
+ new_function = emalloc(sizeof(zend_op_array));
+ memcpy(new_function, func, sizeof(zend_op_array));
function_add_ref(new_function);
function_name = STR_ALLOC(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
function_name->val[0] = '\0';
do {
- function_name->len = snprintf(function_name->val + 1,
sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
+ function_name->len = snprintf(function_name->val + 1,
sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1;
} while (zend_hash_add_ptr(EG(function_table), function_name, new_function) == NULL);
zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
RETURN_STR(function_name);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 28938e5..7fb89bc 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1179,9 +1179,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char
*s
} else {
retval = FAILURE;
}
- if (retval_ptr) {
- zval_dtor(&pv);
- }
+ zval_dtor(&pv);
return retval;
}
/* }}} */