Index: /trunk/utils.c
===================================================================
--- /trunk/utils.c	(revision 404)
+++ /trunk/utils.c	(revision 405)
@@ -624,5 +624,5 @@
 }
 /* }}} */
-static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
+static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */
 {
 	int i;
@@ -668,7 +668,9 @@
 #endif
 
-	xc_undo_pass_two(CG(active_op_array) TSRMLS_CC);
-	xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC);
-	xc_redo_pass_two(CG(active_op_array) TSRMLS_CC);
+	if (install != XC_InstallNoBinding) {
+		xc_undo_pass_two(CG(active_op_array) TSRMLS_CC);
+		xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC);
+		xc_redo_pass_two(CG(active_op_array) TSRMLS_CC);
+	}
 
 	i = 1;
@@ -676,5 +678,5 @@
 }
 /* }}} */
-void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC) /* {{{ */
+void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */
 {
 	/* restore first first install function/class */
@@ -689,9 +691,9 @@
 #endif
 
-	if (install) {
+	if (install != XC_NoInstall) {
 		CG(in_compilation)    = 1;
 		CG(compiled_filename) = sandbox->filename;
 		CG(zend_lineno)       = 0;
-		xc_sandbox_install(sandbox TSRMLS_CC);
+		xc_sandbox_install(sandbox, install TSRMLS_CC);
 		CG(in_compilation)    = 0;
 		CG(compiled_filename) = NULL;
Index: /trunk/utils.h
===================================================================
--- /trunk/utils.h	(revision 404)
+++ /trunk/utils.h	(revision 405)
@@ -100,5 +100,11 @@
 } xc_sandbox_t;
 
+typedef enum _xc_install_action_t {
+    XC_NoInstall,
+    XC_Install,
+    XC_InstallNoBinding
+} xc_install_action_t;
+
 void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce));
 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC);
-void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC);
+void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC);
Index: /trunk/xcache.c
===================================================================
--- /trunk/xcache.c	(revision 404)
+++ /trunk/xcache.c	(revision 405)
@@ -87,4 +87,5 @@
 
 static zend_bool xc_initized = 0;
+static zend_compile_file_t *origin_compile_file = NULL;
 static zend_compile_file_t *old_compile_file = NULL;
 static zend_llist_element  *xc_llist_zend_extension = NULL;
@@ -974,4 +975,6 @@
 	old_constinfo_cnt = zend_hash_num_elements(EG(zend_constants));
 
+	php->op_array = NULL;
+	XG(initial_compile_file_called) = 0;
 	zend_try {
 		op_array = old_compile_file(h, type TSRMLS_CC);
@@ -986,4 +989,8 @@
 	if (op_array == NULL) {
 		goto err_op_array;
+	}
+
+	if (!XG(initial_compile_file_called)) {
+		return op_array;
 	}
 
@@ -1164,4 +1171,10 @@
 }
 /* }}} */
+static zend_op_array *xc_check_initial_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
+{
+	XG(initial_compile_file_called) = 1;
+	return origin_compile_file(h, type TSRMLS_CC);
+}
+/* }}} */
 static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
 {
@@ -1290,4 +1303,11 @@
 		}
 
+		/* not cachable */
+		if (!php.op_array) {
+			cache->compiling = 0;
+			xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
+			return op_array;
+		}
+
 		xce.data.php = &php;
 	}
@@ -1355,5 +1375,5 @@
 		}
 		if (newlycompiled) {
-			xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
+			xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
 		}
 		return xc_compile_restore(stored_xce, h TSRMLS_CC);
@@ -1363,5 +1383,5 @@
 			/* install it */
 			CG(active_op_array) = op_array;
-			xc_sandbox_free(&sandbox, 1 TSRMLS_CC);
+			xc_sandbox_free(&sandbox, XC_Install TSRMLS_CC);
 		}
 	}
@@ -1371,5 +1391,5 @@
 	if (newlycompiled) {
 		xc_free_php(&php TSRMLS_CC);
-		xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
+		xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
 	}
 
@@ -1564,4 +1584,9 @@
 		zend_compile_file = old_compile_file;
 		old_compile_file = NULL;
+	}
+
+	if (origin_compile_file) {
+		zend_compile_file = origin_compile_file;
+		origin_compile_file = NULL;
 	}
 
@@ -2915,5 +2940,5 @@
 #endif
 /* }}} */
-static startup_func_t xc_last_ext_startup = NULL;
+static startup_func_t xc_last_ext_startup;
 static int xc_zend_startup_last(zend_extension *extension) /* {{{ */
 {
@@ -2936,4 +2961,10 @@
 {
 	xc_zend_extension_gotup = 1;
+
+	if (!origin_compile_file) {
+		origin_compile_file = zend_compile_file;
+		zend_compile_file = xc_check_initial_compile_file;
+	}
+
 	if (zend_llist_count(&zend_extensions) > 1) {
 		zend_llist_position lpos;
Index: /trunk/xcache_globals.h
===================================================================
--- /trunk/xcache_globals.h	(revision 404)
+++ /trunk/xcache_globals.h	(revision 405)
@@ -1,4 +1,5 @@
 
 ZEND_BEGIN_MODULE_GLOBALS(xcache)
+	zend_bool initial_compile_file_called; /* true is origin_compile_file is called */
 	zend_bool cacher;      /* true if enabled */
 	zend_bool stat;
