Index: /trunk/processor/head.m4
===================================================================
--- /trunk/processor/head.m4	(revision 188)
+++ /trunk/processor/head.m4	(revision 189)
@@ -5,4 +5,5 @@
 
 #include "php.h"
+#include "zend_extensions.h"
 #include "zend_compile.h"
 #include "zend_API.h"
@@ -19,4 +20,11 @@
 extern unsigned int zend_hash_canary;
 #endif
+extern zend_bool xc_have_op_array_ctor;
+static void xc_zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
+{
+	if (extension->op_array_ctor) {
+		extension->op_array_ctor(op_array);
+	}
+}
 
 define(`SIZEOF_zend_uint', `sizeof(zend_uint)')
Index: /trunk/processor/processor.m4
===================================================================
--- /trunk/processor/processor.m4	(revision 188)
+++ /trunk/processor/processor.m4	(revision 189)
@@ -474,14 +474,4 @@
 		STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
 		define(`SKIPASSERT_ONCE')
-
-	IFRESTORE(`
-#ifdef ZEND_ENGINE_2
-		if (dst->scope) {
-			dst->scope = xc_get_class(processor, (zend_ulong) dst->scope);
-			xc_fix_method(processor, dst);
-		}
-#endif
-	')
-
 	}
 	else
@@ -496,13 +486,4 @@
 	PROC_ZSTRING(, function_name)
 #ifdef ZEND_ENGINE_2
-	IFRESTORE(`
-		if (dst->scope) {
-			dst->scope = xc_get_class(processor, (zend_ulong) dst->scope);
-			xc_fix_method(processor, dst);
-		}
-		DONE(scope)
-	', `
-		PROC_CLASS_ENTRY_P(scope)
-	')
 	DISPATCH(zend_uint, fn_flags)
 	dnl mark it as -1 on store, and lookup parent on restore
@@ -637,4 +618,24 @@
 #endif
 	} while (0);
+
+	IFRESTORE(`
+#ifdef ZEND_ENGINE_2
+		if (dst->scope) {
+			dst->scope = xc_get_class(processor, (zend_ulong) dst->scope);
+			xc_fix_method(processor, dst);
+		}
+		DONE(scope)
+#endif
+	', `
+#ifdef ZEND_ENGINE_2
+		PROC_CLASS_ENTRY_P(scope)
+#endif
+	')
+
+	IFRESTORE(`
+		if (xc_have_op_array_ctor) {
+			zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) xc_zend_extension_op_array_ctor_handler, dst TSRMLS_CC);
+		}
+	')
 ')
 dnl }}}
Index: /trunk/xcache.c
===================================================================
--- /trunk/xcache.c	(revision 188)
+++ /trunk/xcache.c	(revision 189)
@@ -96,4 +96,6 @@
 static zend_bool xc_test = 0;
 static zend_bool xc_readonly_protection = 0;
+
+zend_bool xc_have_op_array_ctor = 0;
 
 static zend_bool xc_module_gotup = 0;
@@ -2281,4 +2283,6 @@
 {
 	char *env;
+	zend_extension *ext;
+	zend_llist_position lpos;
 
 	xc_module_gotup = 1;
@@ -2289,4 +2293,15 @@
 		}
 	}
+
+	/* cache if there's an op_array_ctor */
+	for (ext = zend_llist_get_first_ex(&zend_extensions, &lpos);
+			ext;
+			ext = zend_llist_get_next_ex(&zend_extensions, &lpos)) {
+		if (ext->op_array_ctor) {
+			xc_have_op_array_ctor = 1;
+			break;
+		}
+	}
+
 
 #ifndef PHP_GINIT
