diff options
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index b8c3f11974..f1bcc74a58 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1143,26 +1143,23 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */ ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ { - zval pv; zend_op_array *new_op_array; uint32_t original_compiler_options; zend_result retval; + zend_string *code_str; if (retval_ptr) { - ZVAL_NEW_STR(&pv, zend_string_alloc(str_len + sizeof("return ;")-1, 0)); - memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); - memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len); - Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; - Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; + code_str = zend_string_concat3( + "return ", sizeof("return ")-1, str, str_len, ";", sizeof(";")-1); } else { - ZVAL_STRINGL(&pv, str, str_len); + code_str = zend_string_init(str, str_len, 0); } /*printf("Evaluating '%s'\n", pv.value.str.val);*/ original_compiler_options = CG(compiler_options); CG(compiler_options) = ZEND_COMPILE_DEFAULT_FOR_EVAL; - new_op_array = zend_compile_string(&pv, string_name); + new_op_array = zend_compile_string(code_str, string_name); CG(compiler_options) = original_compiler_options; if (new_op_array) { @@ -1200,7 +1197,7 @@ ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *re } else { retval = FAILURE; } - zval_ptr_dtor_str(&pv); + zend_string_release(code_str); return retval; } /* }}} */ |