Use better data structures (incomplete; able to run bench.php)

This commit is contained in:
Dmitry Stogov 2014-02-18 16:27:38 +04:00
parent 1c4f3d39a8
commit 5de7115679
17 changed files with 781 additions and 597 deletions

View File

@ -2168,30 +2168,30 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
* If it's an old-style constructor, store it only if we don't have
* a constructor already.
*/
if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name, lc_class_name, class_name_len+1)) {
if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name->val, lc_class_name, class_name_len+1)) {
ctor = reg_function;
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) {
ctor = reg_function;
} else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1)) {
dtor = reg_function;
if (internal_function->num_args) {
zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name->val, ptr->fname);
}
} else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME) - 1)) {
clone = reg_function;
} else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME) - 1)) {
__call = reg_function;
} else if ((fname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1)) {
__callstatic = reg_function;
} else if ((fname_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME) - 1)) {
__tostring = reg_function;
} else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME) - 1)) {
__get = reg_function;
} else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME) - 1)) {
__set = reg_function;
} else if ((fname_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME) - 1)) {
__unset = reg_function;
} else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) {
} else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) {
__isset = reg_function;
} else {
reg_function = NULL;

View File

@ -1636,7 +1636,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
if (!CG(active_class_entry)->constructor) {
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
}
} else if ((name->len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
} else if ((name->len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1))) {
if (CG(active_class_entry)->constructor) {
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name->val);
}

View File

@ -72,9 +72,9 @@ static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *sho
Z_SET_REFCOUNT_P(z, 1);
//??? Z_UNSET_ISREF_P(z);
if (Z_ISREF_P(z)) {
zend_reference *ref = Z_REF_P(z);
ZVAL_COPY_VALUE(z, &ref->val);
efree(ref);
//??? zend_reference *ref = Z_REF_P(z);
//??? ZVAL_COPY_VALUE(z, &ref->val);
//??? efree(ref);
}
should_free->var = z;
/* should_free->is_var = 1; */
@ -82,9 +82,9 @@ static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *sho
if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) {
//??? Z_UNSET_ISREF_P(z);
if (Z_ISREF_P(z)) {
zend_reference *ref = Z_REF_P(z);
ZVAL_COPY_VALUE(z, &ref->val);
efree(ref);
//??? zend_reference *ref = Z_REF_P(z);
//??? ZVAL_COPY_VALUE(z, &ref->val);
//??? efree(ref);
}
}
}
@ -189,7 +189,27 @@ static zend_always_inline zval *_get_zval_ptr_tmp(zend_uint var, const zend_exec
static zend_always_inline zval *_get_zval_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
return should_free->var = EX_VAR(var);
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
ret = Z_INDIRECT_P(ret);
}
should_free->var = ret;
return ret;
}
static zend_always_inline zval *_get_zval_ptr_var_deref(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
ret = Z_INDIRECT_P(ret);
}
should_free->var = ret;
if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static zend_never_inline zval *_get_zval_cv_lookup(zend_uint var, int type TSRMLS_DC)
@ -301,6 +321,18 @@ static zend_always_inline zval *_get_zval_ptr_cv(zend_uint var, int type TSRMLS_
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref(zend_uint var, int type TSRMLS_DC)
{
zval *ret = EX_VAR_NUM_2(EG(current_execute_data), var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup(var, type TSRMLS_CC);
} else if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
@ -311,6 +343,18 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_dat
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_R(var TSRMLS_CC);
} else if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
@ -321,6 +365,18 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_UNSET(var TSRMLS_CC);
} else if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
@ -331,6 +387,18 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_da
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_IS(var TSRMLS_CC);
} else if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
@ -341,6 +409,18 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_da
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_RW(var TSRMLS_CC);
} else if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
@ -351,6 +431,18 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_dat
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
zval *ret = EX_VAR_NUM(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_W(var TSRMLS_CC);
} else if (UNEXPECTED(Z_TYPE_P(ret) == IS_REFERENCE)) {
ret = Z_REFVAL_P(ret);
}
return ret;
}
static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
{
/* should_free->is_var = 0; */
@ -379,6 +471,34 @@ static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_
return NULL;
}
static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
{
/* should_free->is_var = 0; */
switch (op_type) {
case IS_CONST:
should_free->var = 0;
return node->zv;
break;
case IS_TMP_VAR:
should_free->var = TMP_FREE(EX_VAR(node->var));
return EX_VAR(node->var);
break;
case IS_VAR:
return _get_zval_ptr_var_deref(node->var, execute_data, should_free TSRMLS_CC);
break;
case IS_UNUSED:
should_free->var = 0;
return NULL;
break;
case IS_CV:
should_free->var = 0;
return _get_zval_ptr_cv_deref(node->var, type TSRMLS_CC);
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
return NULL;
}
//???
#if 0
static zend_always_inline zval **_get_zval_ptr_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)

View File

@ -80,9 +80,9 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
} else {
if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_TYPE_P(zval_ptr) == IS_REFERENCE) {
/* convert reference to regular value */
zend_reference *ref = Z_REF_P(zval_ptr);
ZVAL_COPY_VALUE(zval_ptr, &ref->val);
efree_rel(ref);
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, &ref->val);
//??? efree_rel(ref);
}
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
@ -99,9 +99,9 @@ static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LIN
} else {
if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_TYPE_P(zval_ptr) == IS_REFERENCE) {
/* convert reference to regular value */
zend_reference *ref = Z_REF_P(zval_ptr);
ZVAL_COPY_VALUE(zval_ptr, &ref->val);
efree_rel(ref);
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, &ref->val);
//??? efree_rel(ref);
}
}
}
@ -188,7 +188,7 @@ struct _zend_vm_stack {
} while (0)
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(int count) {
zend_vm_stack page = (zend_vm_stack)emalloc(ZEND_MM_ALIGNED_SIZE(sizeof(*page)) + sizeof(void*) * count);
zend_vm_stack page = (zend_vm_stack)emalloc(ZEND_MM_ALIGNED_SIZE(sizeof(*page)) + sizeof(zval) * count);
page->top = ZEND_VM_STACK_ELEMETS(page);
page->end = page->top + count;

View File

@ -434,9 +434,9 @@ ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ *
_zval_internal_dtor_for_ptr(zval_ptr ZEND_FILE_LINE_CC);
} else if (Z_REFCOUNT_P(zval_ptr) == 1) {
if (Z_ISREF_P(zval_ptr)) {
zend_reference *ref = Z_REF_P(zval_ptr);
ZVAL_COPY_VALUE(zval_ptr, Z_REFVAL_P(zval_ptr));
efree(ref);
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, Z_REFVAL_P(zval_ptr));
//??? efree(ref);
}
}
}

View File

@ -267,7 +267,7 @@ ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *p
if (ht->pDestructor) {
ht->pDestructor(&p->val);
}
p->val = *pData;
ZVAL_COPY_VALUE(&p->val, pData);
HANDLE_UNBLOCK_INTERRUPTIONS();
return &p->val;
}
@ -284,7 +284,7 @@ ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *p
p->h = h;
p->key = key;
STR_ADDREF(key);
p->val = *pData;
ZVAL_COPY_VALUE(&p->val, pData);
nIndex = h & ht->nTableMask;
p->val.u.next = ht->arHash[nIndex];
ht->arHash[nIndex] = idx;
@ -342,7 +342,7 @@ ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, zv
if (ht->pDestructor) {
ht->pDestructor(&p->val);
}
p->val = *pData;
ZVAL_COPY_VALUE(&p->val, pData);
HANDLE_UNBLOCK_INTERRUPTIONS();
if ((long)h >= (long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
@ -373,7 +373,7 @@ new_packed:
p = ht->arData + h;
p->h = h;
p->key = NULL;
p->val = *pData;
ZVAL_COPY_VALUE(&p->val, pData);
p->val.u.next = INVALID_IDX;
HANDLE_UNBLOCK_INTERRUPTIONS();
@ -395,7 +395,7 @@ convert_to_hash:
if (ht->pDestructor) {
ht->pDestructor(&p->val);
}
p->val = *pData;
ZVAL_COPY_VALUE(&p->val, pData);
HANDLE_UNBLOCK_INTERRUPTIONS();
if ((long)h >= (long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
@ -418,7 +418,7 @@ convert_to_hash:
p->h = h;
p->key = NULL;
nIndex = h & ht->nTableMask;
p->val = *pData;
ZVAL_COPY_VALUE(&p->val, pData);
p->val.u.next = ht->arHash[nIndex];
ht->arHash[nIndex] = idx;
HANDLE_UNBLOCK_INTERRUPTIONS();

File diff suppressed because it is too large Load Diff

View File

@ -1925,7 +1925,8 @@ inline_html:
}
<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
ZVAL_STRINGL(zendlval, yytext, yyleng);
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
BEGIN(INITIAL);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
}

View File

@ -1302,7 +1302,7 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
{
int length = Z_STRLEN_P(op1) + 1;
zend_string *buf = STR_REALLOC(Z_STR_P(op1), length + 1, 0);
zend_string *buf = STR_REALLOC(Z_STR_P(op1), length, 0);
buf->val[length - 1] = (char) Z_LVAL_P(op2);
buf->val[length] = 0;
@ -1314,10 +1314,11 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2)
/* must support result==op1 */
ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
{
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
zend_string *buf = STR_REALLOC(Z_STR_P(op1), length + 1, 0);
int op1_len = Z_STRLEN_P(op1);
int length = op1_len + Z_STRLEN_P(op2);
zend_string *buf = STR_REALLOC(Z_STR_P(op1), length, 0);
memcpy(buf->val + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
buf->val[length] = 0;
ZVAL_STR(result, buf);
return SUCCESS;
@ -1353,16 +1354,17 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
op2 = &op2_copy;
}
if (result==op1 && !IS_INTERNED(Z_STR_P(op1))) { /* special case, perform operations on result */
uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
uint op1_len = Z_STRLEN_P(op1);
uint res_len = op1_len + Z_STRLEN_P(op2);
if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) {
ZVAL_EMPTY_STRING(result);
zend_error(E_ERROR, "String size overflow");
}
Z_STR_P(result) = STR_REALLOC(Z_STR_P(result), res_len+1, 0 );
Z_STR_P(result) = STR_REALLOC(Z_STR_P(result), res_len, 0 );
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
memcpy(Z_STRVAL_P(result) + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
Z_STRVAL_P(result)[res_len]=0;
} else {
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);

View File

@ -68,6 +68,12 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC)
}
}
break;
case IS_REFERENCE:
if (Z_DELREF_P(zvalue) == 0) {
zval_dtor(Z_REFVAL_P(zvalue));
efree(Z_REF_P(zvalue));
}
break;
case IS_LONG:
case IS_DOUBLE:
case IS_BOOL:
@ -117,6 +123,10 @@ ZEND_API void _zval_dtor_func_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
zend_list_delete(Z_RES_P(zvalue));
}
break;
case IS_REFERENCE:
zval_dtor(Z_REFVAL_P(zvalue));
efree(Z_REF_P(zvalue));
break;
case IS_LONG:
case IS_DOUBLE:
case IS_BOOL:

View File

@ -32,8 +32,8 @@ ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
fast_add_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -47,8 +47,8 @@ ZEND_VM_HANDLER(2, ZEND_SUB, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
fast_sub_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -62,8 +62,8 @@ ZEND_VM_HANDLER(3, ZEND_MUL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
fast_mul_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -77,8 +77,8 @@ ZEND_VM_HANDLER(4, ZEND_DIV, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
fast_div_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -92,8 +92,8 @@ ZEND_VM_HANDLER(5, ZEND_MOD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
fast_mod_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -107,8 +107,8 @@ ZEND_VM_HANDLER(6, ZEND_SL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
shift_left_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -122,8 +122,8 @@ ZEND_VM_HANDLER(7, ZEND_SR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
shift_right_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -137,8 +137,8 @@ ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
concat_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -152,8 +152,8 @@ ZEND_VM_HANDLER(15, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
is_identical_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -168,8 +168,8 @@ ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
is_identical_function(result,
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
FREE_OP1();
FREE_OP2();
@ -185,8 +185,8 @@ ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC));
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -201,8 +201,8 @@ ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC));
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -217,8 +217,8 @@ ZEND_VM_HANDLER(19, ZEND_IS_SMALLER, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC));
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -233,8 +233,8 @@ ZEND_VM_HANDLER(20, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC));
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -248,8 +248,8 @@ ZEND_VM_HANDLER(9, ZEND_BW_OR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
bitwise_or_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -263,8 +263,8 @@ ZEND_VM_HANDLER(10, ZEND_BW_AND, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
bitwise_and_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -278,8 +278,8 @@ ZEND_VM_HANDLER(11, ZEND_BW_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
bitwise_xor_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -293,8 +293,8 @@ ZEND_VM_HANDLER(14, ZEND_BOOL_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
boolean_xor_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
FREE_OP2();
CHECK_EXCEPTION();
@ -308,7 +308,7 @@ ZEND_VM_HANDLER(12, ZEND_BW_NOT, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
bitwise_not_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@ -321,7 +321,7 @@ ZEND_VM_HANDLER(13, ZEND_BOOL_NOT, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
boolean_not_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@ -495,8 +495,9 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
if (Z_ISREF_P(var_ptr)) {
var_ptr = Z_REFVAL_P(var_ptr);
//???deref
if (Z_ISREF_P(var_ptr)) {
var_ptr = Z_REFVAL_P(var_ptr);
}
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@ -1062,7 +1063,8 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
ZVAL_COPY(EX_VAR(opline->result.var), retval);
// ZVAL_COPY(EX_VAR(opline->result.var), retval);
ZVAL_INDIRECT(EX_VAR(opline->result.var), retval);
//??? switch (type) {
//??? case BP_VAR_R:
//??? case BP_VAR_IS:
@ -2028,7 +2030,7 @@ ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
int ret;
SAVE_OPLINE();
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
ret = Z_LVAL_P(val);
@ -2058,7 +2060,7 @@ ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY)
int ret;
SAVE_OPLINE();
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
ret = Z_LVAL_P(val);
@ -2088,7 +2090,7 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY)
int retval;
SAVE_OPLINE();
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
retval = Z_LVAL_P(val);
@ -2122,7 +2124,7 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
int retval;
SAVE_OPLINE();
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
retval = Z_LVAL_P(val);
@ -2152,7 +2154,7 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY)
int retval;
SAVE_OPLINE();
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
retval = Z_LVAL_P(val);

File diff suppressed because it is too large Load Diff

View File

@ -135,6 +135,24 @@ $op2_get_zval_ptr = array(
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
$op1_get_zval_ptr_deref = array(
"ANY" => "get_zval_ptr_deref(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
"CONST" => "opline->op1.zv",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
);
$op2_get_zval_ptr_deref = array(
"ANY" => "get_zval_ptr_deref(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
"CONST" => "opline->op2.zv",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
$op1_get_obj_zval_ptr = array(
"ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
@ -274,6 +292,7 @@ function helper_name($name, $spec, $op1, $op2) {
// Generates code for opcode handler or helper
function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
global $op1_type, $op2_type, $op1_get_zval_ptr, $op2_get_zval_ptr,
$op1_get_zval_ptr_deref, $op2_get_zval_ptr_deref,
$op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr,
$op1_is_tmp_free, $op2_is_tmp_free, $op1_free, $op2_free,
$op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var,
@ -289,6 +308,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
"/OP2_FREE/",
"/GET_OP1_ZVAL_PTR\(([^)]*)\)/",
"/GET_OP2_ZVAL_PTR\(([^)]*)\)/",
"/GET_OP1_ZVAL_PTR_DEREF\(([^)]*)\)/",
"/GET_OP2_ZVAL_PTR_DEREF\(([^)]*)\)/",
"/GET_OP1_OBJ_ZVAL_PTR\(([^)]*)\)/",
"/GET_OP2_OBJ_ZVAL_PTR\(([^)]*)\)/",
"/IS_OP1_TMP_FREE\(\)/",
@ -319,6 +340,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op2_free[$op2],
$op1_get_zval_ptr[$op1],
$op2_get_zval_ptr[$op2],
$op1_get_zval_ptr_deref[$op1],
$op2_get_zval_ptr_deref[$op2],
$op1_get_obj_zval_ptr[$op1],
$op2_get_obj_zval_ptr[$op2],
$op1_is_tmp_free[$op1],

View File

@ -4858,7 +4858,7 @@ PHP_FUNCTION(str_repeat)
char *input_str; /* Input string */
int input_len;
long mult; /* Multiplier */
char *result; /* Resulting string */
zend_string *result; /* Resulting string */
size_t result_len; /* Length of the resulting string */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &input_str, &input_len, &mult) == FAILURE) {
@ -4877,18 +4877,19 @@ PHP_FUNCTION(str_repeat)
/* Initialize the result string */
result_len = input_len * mult;
result = (char *)safe_emalloc(input_len, mult, 1);
//??? result = (char *)safe_emalloc(input_len, mult, 1);
result = STR_ALLOC(result_len, 0);
/* Heavy optimization for situations where input string is 1 byte long */
if (input_len == 1) {
memset(result, *(input_str), mult);
memset(result->val, *(input_str), mult);
} else {
char *s, *e, *ee;
int l=0;
memcpy(result, input_str, input_len);
s = result;
e = result + input_len;
ee = result + result_len;
memcpy(result->val, input_str, input_len);
s = result->val;
e = result->val + input_len;
ee = result->val + result_len;
while (e<ee) {
l = (e-s) < (ee-e) ? (e-s) : (ee-e);
@ -4897,10 +4898,9 @@ PHP_FUNCTION(str_repeat)
}
}
result[result_len] = '\0';
result->val[result_len] = '\0';
//??? RETURN_STRINGL(result, result_len, 0);
RETURN_STRINGL(result, result_len);
RETURN_STR(result);
}
/* }}} */

View File

@ -837,8 +837,7 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR
if (has_per_host_config && host && host_len) {
/* Search for source array matching the host from configuration_hash */
//??? remove -1
if ((tmp = zend_hash_str_find(&configuration_hash, host, host_len-1)) != NULL) {
if ((tmp = zend_hash_str_find(&configuration_hash, host, host_len)) != NULL) {
php_ini_activate_config(Z_ARRVAL_P(tmp), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE TSRMLS_CC);
}
}
@ -849,8 +848,7 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR
*/
PHPAPI zval *cfg_get_entry(const char *name, uint name_length)
{
//??? remove -1
return zend_hash_str_find(&configuration_hash, name, name_length-1);
return zend_hash_str_find(&configuration_hash, name, name_length);
}
/* }}} */

View File

@ -845,7 +845,7 @@ static int sapi_cgi_activate(TSRMLS_D)
server_name_len = strlen(server_name);
server_name = estrndup(server_name, server_name_len);
zend_str_tolower(server_name, server_name_len);
php_ini_activate_per_host_config(server_name, server_name_len + 1 TSRMLS_CC);
php_ini_activate_per_host_config(server_name, server_name_len TSRMLS_CC);
efree(server_name);
}
}

View File

@ -784,7 +784,7 @@ static int sapi_cgi_activate(TSRMLS_D)
server_name_len = strlen(server_name);
server_name = estrndup(server_name, server_name_len);
zend_str_tolower(server_name, server_name_len);
php_ini_activate_per_host_config(server_name, server_name_len + 1 TSRMLS_CC);
php_ini_activate_per_host_config(server_name, server_name_len TSRMLS_CC);
efree(server_name);
}
}