Index: apc_compile.c =================================================================== RCS file: /repository/pecl/apc/apc_compile.c,v retrieving revision 3.41 diff -u -r3.41 apc_compile.c --- apc_compile.c 12 Mar 2006 00:31:45 -0000 3.41 +++ apc_compile.c 13 Mar 2006 16:38:08 -0000 @@ -1805,6 +1805,51 @@ } } /* }}} */ + +/* {{{ my_copy_default_args */ +static int my_copy_default_args(zend_op_array* dst, zend_op_array* src) +{ + int i; + int needcopy = 0; + if(src->num_args == src->required_num_args) + { + /* yay !, no default args */ + return 1; + } + for (i = 0; i < src->last; i++) + { + zend_op *opcode = src->opcodes+i; + if(opcode->opcode == ZEND_RECV_INIT && + opcode->op2.u.constant.type == IS_CONSTANT_ARRAY) + { + needcopy = 1; + break; + } + } + if(needcopy) + { + dst->opcodes = (zend_op*) apc_xmemcpy(src->opcodes, + sizeof(zend_op) * src->last, + apc_php_malloc); + for (i = 0; i < src->last; i++) + { + zend_op *opcode = src->opcodes+i; + if(opcode->opcode == ZEND_RECV_INIT && + opcode->op2.u.constant.type == IS_CONSTANT_ARRAY) + { + if(!(my_copy_zend_op(dst->opcodes+i, src->opcodes+i, + apc_php_malloc, apc_php_free))) + { + //TODO: cleanup code + } + } + } + + apc_fixup_op_array_jumps(dst,src); + } + return 1; +} +/* }}} */ #endif /* {{{ apc_copy_op_array_for_execution */ @@ -1815,6 +1860,7 @@ dst->static_variables = my_copy_static_variables(src, apc_php_malloc, apc_php_free); #ifdef ZEND_ENGINE_2 my_fetch_global_vars(dst TSRMLS_CC); + my_copy_default_args(dst, src); #endif /*check_op_array_integrity(dst);*/ return dst; @@ -1832,6 +1878,7 @@ dst->op_array.static_variables = my_copy_static_variables(&dst->op_array, apc_php_malloc, apc_php_free); #ifdef ZEND_ENGINE_2 my_fetch_global_vars(&dst->op_array TSRMLS_CC); + my_copy_default_args(&dst->op_array, &src->op_array); #endif /*check_op_array_integrity(&dst->op_array);*/ return dst;