diff --git a/processor/foot.m4 b/processor/foot.m4 index ff614ef..d92d361 100644 --- a/processor/foot.m4 +++ b/processor/foot.m4 @@ -131,17 +131,15 @@ EXPORTED_FUNCTION(`zval *xc_processor_restore_var(zval *dst, const xc_entry_var_ dnl fprintf(stderr, "mark[%p] = %p\n", src, dst); zend_hash_add(&processor.zvalptrs, (char *)src->value, sizeof(src->value), (void *) &dst, sizeof(dst), NULL); } - processor.entry_var_src = src; processor.index_to_ce = index_to_ce; #ifdef ZEND_ENGINE_2 if (src->objects_count) { processor.object_handles = emalloc(sizeof(*processor.object_handles) * src->objects_count); - xc_vector_init(zend_object_handle, &processor.objects, 0); for (i = 0; i < src->objects_count; ++i) { zend_object *object = emalloc(sizeof(*object)); - xc_restore_zend_object(&processor, object, &src->objects[i] TSRMLS_CC); processor.object_handles[i] = zend_objects_store_put(object, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) zend_objects_free_object_storage, NULL TSRMLS_CC); + xc_restore_zend_object(&processor, object, &src->objects[i] TSRMLS_CC); } } #endif diff --git a/processor/processor.m4 b/processor/processor.m4 index c33999c..25ba045 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -123,11 +123,11 @@ DEF_STRUCT_P_FUNC(`zend_object', , `dnl {{{ xc_var_collect_class(processor, SRC(ce) TSRMLS_CC); DONE(ce) ', `IFSTORE(` - DST(ce) = (zend_class_entry *) xc_var_store_ce(processor, DST(ce) TSRMLS_CC); + DST(ce) = (zend_class_entry *) xc_var_store_ce(processor, SRC(ce) TSRMLS_CC); DONE(ce) ', `IFRESTORE(` assert(processor->index_to_ce); - DST(ce) = processor->index_to_ce[(size_t) DST(ce)]; + DST(ce) = processor->index_to_ce[(size_t) SRC(ce)]; DONE(ce) ', ` PROCESS_SCALAR(ce, lu, unsigned long) @@ -149,10 +149,10 @@ DEF_STRUCT_P_FUNC(`zend_object_value', , `dnl {{{ xc_var_collect_object(processor, SRC(handle) TSRMLS_CC); DONE(handle) ', `IFSTORE(` - DST(handle) = (zend_object_handle) xc_var_store_handle(processor, DST(handle) TSRMLS_CC); + DST(handle) = (zend_object_handle) xc_var_store_handle(processor, SRC(handle) TSRMLS_CC); DONE(handle) ', `IFRESTORE(` - DST(handle) = xc_var_restore_handle(processor, (size_t) DST(handle) TSRMLS_CC); + DST(handle) = xc_var_restore_handle(processor, (size_t) SRC(handle) TSRMLS_CC); DONE(handle) ', ` PROCESS(zend_object_handle, handle) @@ -1384,6 +1384,7 @@ DEF_STRUCT_P_FUNC(`xc_entry_php_t', , `dnl {{{ dnl }}} DEF_STRUCT_P_FUNC(`xc_entry_var_t', , `dnl {{{ IFCALCSTORE(`xc_entry_var_t *vsrc = /* const_cast */ (xc_entry_var_t *) src;') + IFRESTORE(`processor->entry_var_src = src;') dnl restore is done in foot.m4 STRUCT(xc_entry_t, entry) diff --git a/processor/var-helper.h b/processor/var-helper.h index 92feb22..0ba599a 100644 --- a/processor/var-helper.h +++ b/processor/var-helper.h @@ -20,7 +20,7 @@ static size_t xc_var_store_handle(xc_processor_t *processor, zend_object_handle size_t *index; if (zend_hash_index_find(&processor->handle_to_index, handle, (void **) &index) != SUCCESS) { - php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "Internal error: handle not found in objects"); + php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "Internal error: handle %d not found in objects", handle); return (size_t) -1; }