aboutsummaryrefslogtreecommitdiff
path: root/www/eaccelerator
diff options
context:
space:
mode:
authorAlex Dupre <ale@FreeBSD.org>2006-02-02 09:06:14 +0000
committerAlex Dupre <ale@FreeBSD.org>2006-02-02 09:06:14 +0000
commite6895f029c9f6043a2a07ed3dddcb2aaed95a276 (patch)
treedde39e507f6e30fd588956e4d11cecfb8348dd49 /www/eaccelerator
parentbf239ddc95b37dbd29fce8e4880380c6179701da (diff)
downloadports-e6895f029c9f6043a2a07ed3dddcb2aaed95a276.tar.gz
ports-e6895f029c9f6043a2a07ed3dddcb2aaed95a276.zip
Notes
Diffstat (limited to 'www/eaccelerator')
-rw-r--r--www/eaccelerator/Makefile16
-rw-r--r--www/eaccelerator/files/patch-content.c16
-rw-r--r--www/eaccelerator/files/patch-debug.c12
-rw-r--r--www/eaccelerator/files/patch-ea_restore.c216
-rw-r--r--www/eaccelerator/files/patch-ea_restore.h10
-rw-r--r--www/eaccelerator/files/patch-ea_store.c104
-rw-r--r--www/eaccelerator/files/patch-eaccelerator.c124
-rw-r--r--www/eaccelerator/files/patch-eaccelerator.h124
-rw-r--r--www/eaccelerator/files/patch-encoder.php6
-rw-r--r--www/eaccelerator/files/patch-loader.c13
-rw-r--r--www/eaccelerator/files/patch-opcodes.c113
-rw-r--r--www/eaccelerator/files/patch-optimize.c217
-rw-r--r--www/eaccelerator/files/patch-webui.c204
-rw-r--r--www/eaccelerator/pkg-plist2
14 files changed, 1165 insertions, 12 deletions
diff --git a/www/eaccelerator/Makefile b/www/eaccelerator/Makefile
index ec92f209a1bd..c56084d27103 100644
--- a/www/eaccelerator/Makefile
+++ b/www/eaccelerator/Makefile
@@ -7,7 +7,7 @@
PORTNAME= eaccelerator
DISTVERSION= 0.9.4-rc1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
MASTER_SITE_SUBDIR= ${PORTNAME}
@@ -18,7 +18,6 @@ COMMENT= An opcode cache for PHP with encoder and loader
USE_PHP= session
USE_PHPIZE= yes
USE_PHP_BUILD= yes
-BROKEN_WITH_PHP= 5
CONFIGURE_ARGS= --enable-eaccelerator=shared
@@ -28,15 +27,26 @@ PKGMESSAGE= ${WRKDIR}/pkg-message
PORTDOCS= *
+.include <bsd.port.pre.mk>
+
+.if ${PHP_VER} == 5
+CONFIGURE_ARGS+=--without-eaccelerator-encoder
+PLIST_SUB+= ENCODER="@comment "
+.else
+PLIST_SUB+= ENCODER=""
+
post-build:
@${SED} "s|%%LOCALBASE%%|${LOCALBASE}|g; s|0777|0755|g" \
${WRKSRC}/encoder.php > ${WRKSRC}/encoder
+.endif
do-install:
@${MKDIR} ${PREFIX}/lib/php/${PHP_EXT_DIR}
@${INSTALL_DATA} ${WRKSRC}/modules/${PORTNAME}.so \
${PREFIX}/lib/php/${PHP_EXT_DIR}
+.if ${PHP_VER} == 4
@${INSTALL_SCRIPT} ${WRKSRC}/encoder ${PREFIX}/bin
+.endif
@${MKDIR} ${EXAMPLESDIR}
@${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.ini ${EXAMPLESDIR}
@${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.php ${EXAMPLESDIR}
@@ -49,4 +59,4 @@ do-install:
post-install:
@${CAT} ${PKGMESSAGE}
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/www/eaccelerator/files/patch-content.c b/www/eaccelerator/files/patch-content.c
new file mode 100644
index 000000000000..9cc4057e9fe0
--- /dev/null
+++ b/www/eaccelerator/files/patch-content.c
@@ -0,0 +1,16 @@
+--- content.c.orig Sun Jul 10 10:12:33 2005
++++ content.c Thu Feb 2 09:40:00 2006
+@@ -593,10 +593,13 @@ PHP_FUNCTION(eaccelerator_cache_result)
+ if (zend_eval_string(code, return_value, eval_name TSRMLS_CC) == SUCCESS &&
+ eaccelerator_content_cache_place != eaccelerator_none) {
+
++#ifndef ZEND_ENGINE_2_1
++/* No worko on php >= 5.1.0 */
+ /* clean garbage */
+ while (EG(garbage_ptr)) {
+ zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
+ }
++#endif
+
+ eaccelerator_put(key, key_len, return_value, ttl, eaccelerator_content_cache_place TSRMLS_CC);
+ }
diff --git a/www/eaccelerator/files/patch-debug.c b/www/eaccelerator/files/patch-debug.c
new file mode 100644
index 000000000000..3ac4dc070a26
--- /dev/null
+++ b/www/eaccelerator/files/patch-debug.c
@@ -0,0 +1,12 @@
+--- debug.c.orig Sun Jul 10 10:12:33 2005
++++ debug.c Thu Feb 2 09:40:00 2006
+@@ -66,7 +66,8 @@ void ea_debug_init (TSRMLS_D)
+ void ea_debug_shutdown ()
+ {
+ fflush (F_fp);
+- fclose (F_fp);
++ if (F_fp != stderr)
++ fclose (F_fp);
+ F_fp = NULL;
+ }
+
diff --git a/www/eaccelerator/files/patch-ea_restore.c b/www/eaccelerator/files/patch-ea_restore.c
new file mode 100644
index 000000000000..1bef2b7cee0d
--- /dev/null
+++ b/www/eaccelerator/files/patch-ea_restore.c
@@ -0,0 +1,216 @@
+--- ea_restore.c.orig Wed Aug 3 20:54:32 2005
++++ ea_restore.c Thu Feb 2 09:40:00 2006
+@@ -39,6 +39,9 @@
+ #include "zend.h"
+ #include "zend_API.h"
+ #include "zend_extensions.h"
++#ifdef ZEND_ENGINE_2_1
++#include "zend_vm.h"
++#endif
+
+ #ifndef INCOMPLETE_CLASS
+ # define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
+@@ -69,12 +72,16 @@ dtor_func_t get_zend_destroy_property_in
+ property_dtor = dummy_class_entry.properties_info.pDestructor;
+
+ zend_hash_destroy(&dummy_class_entry.default_properties);
+- zend_hash_destroy(&dummy_class_entry.properties_info);
+- zend_hash_destroy(dummy_class_entry.static_members);
+ zend_hash_destroy(&dummy_class_entry.function_table);
+- FREE_HASHTABLE(dummy_class_entry.static_members);
+ zend_hash_destroy(&dummy_class_entry.constants_table);
+-
++ zend_hash_destroy(&dummy_class_entry.properties_info);
++# ifdef ZEND_ENGINE_2_1
++ zend_hash_destroy(&dummy_class_entry.default_static_members);
++# endif
++# if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_1)
++ zend_hash_destroy(dummy_class_entry.static_members);
++ FREE_HASHTABLE(dummy_class_entry.static_members);
++# endif
+ return property_dtor;
+ }
+ #endif
+@@ -92,6 +99,9 @@ typedef void (*fixup_bucket_t) (void *TS
+ static void fixup_property_info(zend_property_info * from TSRMLS_DC)
+ {
+ FIXUP(from->name);
++#ifdef ZEND_ENGINE_2_1
++ FIXUP(from->doc_comment);
++#endif
+ }
+ #endif
+
+@@ -221,7 +231,12 @@ void fixup_op_array(eaccelerator_op_arra
+ FIXUP(opline->op2.u.jmp_addr);
+ break;
+ }
++# ifdef ZEND_ENGINE_2_1
++ ZEND_VM_SET_OPCODE_HANDLER(opline);
++# else
+ opline->handler = get_opcode_handler(opline->opcode TSRMLS_CC);
++# endif
++
+ #endif
+ }
+ EAG(compress) = 1;
+@@ -234,6 +249,15 @@ void fixup_op_array(eaccelerator_op_arra
+ FIXUP(from->static_variables);
+ fixup_zval_hash(from->static_variables);
+ }
++#ifdef ZEND_ENGINE_2_1
++ if (from->vars != NULL) {
++ zend_uint i;
++ FIXUP(from->vars);
++ for (i = 0; i < from->last_var; i++) {
++ FIXUP(from->vars[i].name);
++ }
++ }
++#endif
+ FIXUP(from->filename);
+ #ifdef ZEND_ENGINE_2
+ FIXUP(from->doc_comment);
+@@ -255,6 +279,9 @@ void fixup_class_entry(eaccelerator_clas
+ FIXUP(from->static_members);
+ fixup_zval_hash(from->static_members);
+ }
++# ifdef ZEND_ENGINE_2_1
++ fixup_zval_hash(&from->default_static_members);
++# endif
+ #else
+ fixup_zval_hash(&from->default_properties);
+ #endif
+@@ -570,12 +597,12 @@ zend_op_array *restore_op_array(zend_op_
+ to->T = from->T;
+ to->brk_cont_array = from->brk_cont_array;
+ to->last_brk_cont = from->last_brk_cont;
+- /*
++
+ to->current_brk_cont = -1;
+ to->static_variables = from->static_variables;
+- to->start_op = to->opcodes;
++/* to->start_op = to->opcodes; */
+ to->backpatch_count = 0;
+- */
++
+ to->return_reference = from->return_reference;
+ to->done_pass_two = 1;
+ to->filename = from->filename;
+@@ -612,6 +639,20 @@ zend_op_array *restore_op_array(zend_op_
+ #endif
+ }
+
++#ifdef ZEND_ENGINE_2_1
++ to->vars = from->vars;
++ to->last_var = from->last_var;
++ to->size_var = 0;
++ if (to->vars) {
++ zend_uint i;
++ to->vars = (zend_compiled_variable*)emalloc(from->last_var*sizeof(zend_compiled_variable));
++ memcpy(to->vars, from->vars, sizeof(zend_compiled_variable) * from->last_var);
++ for (i = 0; i < from->last_var; i ++) {
++ to->vars[i].name = estrndup(from->vars[i].name, from->vars[i].name_len);
++ }
++ }
++#endif
++
+ /* disable deletion in destroy_op_array */
+ ++EAG(refcount_helper);
+ to->refcount = &EAG(refcount_helper);
+@@ -633,6 +674,12 @@ static zend_property_info *restore_prope
+ memcpy(to, from, sizeof(zend_property_info));
+ to->name = emalloc(from->name_length + 1);
+ memcpy(to->name, from->name, from->name_length + 1);
++#ifdef ZEND_ENGINE_2_1
++ if (from->doc_comment != NULL) {
++ to->doc_comment = emalloc(from->doc_comment_len+1);
++ memcpy(to->doc_comment, from->doc_comment, from->doc_comment_len+1);
++ }
++#endif
+ return to;
+ }
+ #endif
+@@ -660,6 +707,12 @@ void restore_class_parent(char *parent,
+ to->clone = to->parent->clone;
+ to->__get = to->parent->__get;
+ to->__set = to->parent->__set;
++# ifdef ZEND_ENGINE_2_1
++ to->__unset = to->parent->__unset;
++ to->__isset = to->parent->__isset;
++ to->serialize_func = to->parent->serialize_func;
++ to->unserialize_func = to->parent->unserialize_func;
++# endif
+ to->__call = to->parent->__call;
+ to->create_object = to->parent->create_object;
+ #else
+@@ -708,6 +761,14 @@ void restore_class_methods(zend_class_en
+ else if (fname_len == sizeof(ZEND_SET_FUNC_NAME) - 1 &&
+ memcmp(fname_lc, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) == 0)
+ to->__set = f;
++# ifdef ZEND_ENGINE_2_1
++ else if (fname_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 &&
++ memcmp(fname_lc, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)) == 0)
++ to->__unset = f;
++ else if (fname_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 &&
++ memcmp(fname_lc, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)) == 0)
++ to->__isset = f;
++# endif
+ else if (fname_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 &&
+ memcmp(fname_lc, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) == 0)
+ to->__call = f;
+@@ -734,11 +795,10 @@ zend_class_entry *restore_class_entry(ze
+ #endif
+
+ ea_debug_pad(EA_DEBUG TSRMLS_CC);
+- ea_debug_printf(EA_DEBUG, "[%d] retore_class_entry: %s\n", getpid(), from->name ? from->name : "(top)");
++ ea_debug_printf(EA_DEBUG, "[%d] restore_class_entry: %s\n", getpid(), from->name ? from->name : "(top)");
+ #ifdef DEBUG
+ EAG(xpad)++;
+ #endif
+-
+ if (to == NULL) {
+ to = emalloc(sizeof(zend_class_entry));
+ }
+@@ -752,9 +812,6 @@ zend_class_entry *restore_class_entry(ze
+ */
+ #ifdef ZEND_ENGINE_2
+ to->ce_flags = from->ce_flags;
+- /*
+- to->static_members = NULL;
+- */
+ to->num_interfaces = from->num_interfaces;
+ if (to->num_interfaces > 0) {
+ to->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *) * to->num_interfaces);
+@@ -765,6 +822,7 @@ zend_class_entry *restore_class_entry(ze
+ }
+
+ to->iterator_funcs = from->iterator_funcs;
++ to->create_object = from->create_object;
+ to->get_iterator = from->get_iterator;
+ to->interface_gets_implemented = from->interface_gets_implemented;
+ #endif
+@@ -813,16 +871,19 @@ zend_class_entry *restore_class_entry(ze
+ (restore_bucket_t) restore_property_info TSRMLS_CC);
+ to->properties_info.pDestructor = properties_info_dtor;
+
++# ifdef ZEND_ENGINE_2_1
++ /* restore default_static_members */
++ restore_zval_hash(&to->default_static_members, &from->default_static_members);
++ to->default_static_members.pDestructor = ZVAL_PTR_DTOR;
++
++ to->static_members = (from->type == ZEND_INTERNAL_CLASS) ? NULL : &to->default_static_members;
++# else
+ if (from->static_members != NULL) {
+ ALLOC_HASHTABLE(to->static_members);
+ restore_zval_hash(to->static_members, from->static_members);
+ to->static_members->pDestructor = ZVAL_PTR_DTOR;
+- /*
+- } else {
+- ALLOC_HASHTABLE(to->static_members);
+- zend_hash_init_ex(to->static_members, 0, NULL, ZVAL_PTR_DTOR, 0, 0);
+- */
+ }
++# endif
+ #else
+ to->refcount = emalloc(sizeof(*to->refcount));
+ *to->refcount = 1;
diff --git a/www/eaccelerator/files/patch-ea_restore.h b/www/eaccelerator/files/patch-ea_restore.h
new file mode 100644
index 000000000000..3b7304f655f9
--- /dev/null
+++ b/www/eaccelerator/files/patch-ea_restore.h
@@ -0,0 +1,10 @@
+--- ea_restore.h.orig Mon Jul 11 19:25:38 2005
++++ ea_restore.h Thu Feb 2 09:40:00 2006
+@@ -34,6 +34,7 @@
+ void fixup_op_array (eaccelerator_op_array * from TSRMLS_DC);
+ void fixup_class_entry (eaccelerator_class_entry * from TSRMLS_DC);
+
++void restore_zval(zval * zv TSRMLS_DC);
+ void restore_class(mm_fc_entry *p TSRMLS_DC);
+ void restore_function(mm_fc_entry *p TSRMLS_DC);
+ zend_op_array* restore_op_array(zend_op_array *to, eaccelerator_op_array *from TSRMLS_DC);
diff --git a/www/eaccelerator/files/patch-ea_store.c b/www/eaccelerator/files/patch-ea_store.c
new file mode 100644
index 000000000000..1f9c5da80d46
--- /dev/null
+++ b/www/eaccelerator/files/patch-ea_store.c
@@ -0,0 +1,104 @@
+--- ea_store.c.orig Mon Jul 11 19:25:38 2005
++++ ea_store.c Thu Feb 2 09:40:00 2006
+@@ -82,6 +82,11 @@ static void calc_property_info(zend_prop
+ EACCELERATOR_ALIGN(EAG(mem));
+ EAG(mem) += sizeof(zend_property_info);
+ calc_string(from->name, from->name_length + 1 TSRMLS_CC);
++#ifdef ZEND_ENGINE_2_1
++ if (from->doc_comment != NULL) {
++ calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC);
++ }
++#endif
+ }
+
+ /* Calculate the size of a point to a class entry */
+@@ -246,6 +251,16 @@ void calc_op_array(zend_op_array * from
+ EAG(mem) += sizeof(HashTable);
+ calc_zval_hash(from->static_variables);
+ }
++#ifdef ZEND_ENGINE_2_1
++ if (from->vars != NULL) {
++ zend_uint i;
++ EACCELERATOR_ALIGN(EAG(mem));
++ EAG(mem) += sizeof(zend_compiled_variable) * from->last_var;
++ for (i = 0; i < from->last_var; i ++) {
++ calc_string(from->vars[i].name, from->vars[i].name_len+1 TSRMLS_CC);
++ }
++ }
++#endif
+ if (from->filename != NULL)
+ calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC);
+ #ifdef ZEND_ENGINE_2
+@@ -285,6 +300,11 @@ void calc_class_entry(zend_class_entry *
+
+ calc_zval_hash(&from->constants_table);
+ calc_zval_hash(&from->default_properties);
++
++#ifdef ZEND_ENGINE_2_1
++ calc_zval_hash(&from->default_static_members);
++#endif
++
+ calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info);
+ if (from->static_members != NULL) {
+ EACCELERATOR_ALIGN(EAG(mem));
+@@ -610,6 +630,10 @@ eaccelerator_op_array *store_op_array(ze
+ to->uses_globals = from->uses_globals;
+ #endif
+ to->static_variables = from->static_variables;
++#ifdef ZEND_ENGINE_2_1
++ to->vars = from->vars;
++ to->last_var = from->last_var;
++#endif
+ to->return_reference = from->return_reference;
+ to->filename = from->filename;
+
+@@ -671,8 +695,24 @@ eaccelerator_op_array *store_op_array(ze
+ EAG(mem) += sizeof(HashTable);
+ store_zval_hash(to->static_variables, from->static_variables);
+ }
++#ifdef ZEND_ENGINE_2_1
++ if (from->vars != NULL) {
++ zend_uint i;
++ EACCELERATOR_ALIGN(EAG(mem));
++ to->last_var = from->last_var;
++ to->vars = (zend_compiled_variable*)EAG(mem);
++ EAG(mem) += sizeof(zend_compiled_variable) * from->last_var;
++ memcpy(to->vars, from->vars, sizeof(zend_compiled_variable) * from->last_var);
++ for (i = 0; i < from->last_var; i ++) {
++ to->vars[i].name = store_string(from->vars[i].name, from->vars[i].name_len+1 TSRMLS_CC);
++ }
++ } else {
++ to->last_var = 0;
++ to->vars = NULL;
++ }
++#endif
+ if (from->filename != NULL) {
+- to->filename = store_string(to->filename, strlen(from->filename) + 1 TSRMLS_CC);
++ to->filename = store_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC);
+ }
+ #ifdef ZEND_ENGINE_2
+ to->line_start = from->line_start;
+@@ -693,6 +733,12 @@ static zend_property_info *store_propert
+ EAG(mem) += sizeof(zend_property_info);
+ memcpy(to, from, sizeof(zend_property_info));
+ to->name = store_string(from->name, from->name_length + 1 TSRMLS_CC);
++#ifdef ZEND_ENGINE_2_1
++ to->doc_comment_len = from->doc_comment_len;
++ if (from->doc_comment != NULL) {
++ to->doc_comment = store_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC);
++ }
++#endif
+ return to;
+ }
+ #endif
+@@ -770,6 +816,10 @@ eaccelerator_class_entry *store_class_en
+ }
+ #else
+ store_zval_hash(&to->default_properties, &from->default_properties);
++#endif
++
++#ifdef ZEND_ENGINE_2_1
++ store_zval_hash(&to->default_static_members, &from->default_static_members);
+ #endif
+ store_hash(&to->function_table, &from->function_table, (store_bucket_t) store_op_array);
+
diff --git a/www/eaccelerator/files/patch-eaccelerator.c b/www/eaccelerator/files/patch-eaccelerator.c
index dcf9318c0e7c..90d43d6ebd03 100644
--- a/www/eaccelerator/files/patch-eaccelerator.c
+++ b/www/eaccelerator/files/patch-eaccelerator.c
@@ -1,10 +1,73 @@
---- eaccelerator.c.orig Thu Nov 24 07:59:33 2005
-+++ eaccelerator.c Thu Nov 24 08:00:58 2005
-@@ -1131,9 +1131,10 @@
+--- eaccelerator.c.orig Sun Nov 20 18:53:43 2005
++++ eaccelerator.c Thu Feb 2 09:40:00 2006
+@@ -110,6 +110,10 @@ extern dtor_func_t properties_info_dtor;
+ /* saved original functions */
+ static zend_op_array *(*mm_saved_zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
+
++#ifdef DEBUG
++static void (*mm_saved_zend_execute)(zend_op_array *op_array TSRMLS_DC);
++#endif
++
+ /* external declarations */
+ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
+
+@@ -251,16 +255,16 @@ static void hash_add_mm(mm_cache_entry *
+ /* check the cache dir */
+ static int check_cache_dir(char *cache_dir) {
+ struct stat buf;
+- int uid = 0;
+- int gid = 0;
+-
++// int uid = 0;
++// int gid = 0;
++
+ if (stat(cache_dir, &buf) == -1) {
+ ea_debug_error("Cache dir does not exist (could not stat %s)\n", cache_dir);
+- return 0;
++ return FAILURE;
+ }
+ if (!(buf.st_mode & S_IFDIR)) {
+ ea_debug_error("%s is not a directory!\n", cache_dir);
+- return 0;
++ return FAILURE;
+ }
+ #if 0
+ uid = getuid();
+@@ -272,7 +276,7 @@ static int check_cache_dir(char *cache_d
+ return 0;
+ }
+ #endif
+- return 1;
++ return SUCCESS;
+ }
+
+ /* Initialise the shared memory */
+@@ -326,11 +330,6 @@ static int init_mm(TSRMLS_D) {
+ eaccelerator_mm_instance->user_hash_cnt = 0;
+ eaccelerator_mm_instance->last_prune = time(0);
+ EACCELERATOR_PROTECT();
+-
+- if (!check_cache_dir(EAG(cache_dir))) {
+- return FAILURE;
+- }
+-
+ return SUCCESS;
+ }
+
+@@ -847,7 +846,7 @@ static mm_cache_entry *eaccelerator_stor
+ q = p->c_head;
+ while (q != NULL) {
+ #ifdef ZEND_ENGINE_2
+- q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC);
++ q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC); // hra: exactly the same?!
+ #else
+ q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC);
+ #endif
+@@ -1131,9 +1130,10 @@ static int eaccelerator_stat(zend_file_h
}
if (zend_is_executing(TSRMLS_C)) {
-+ int tryname_length;
++ int tryname_length;
strncpy(tryname, zend_get_executed_filename(TSRMLS_C), MAXPATHLEN);
tryname[MAXPATHLEN - 1] = 0;
- int tryname_length = strlen(tryname);
@@ -12,7 +75,7 @@
while (tryname_length >= 0 && !IS_SLASH(tryname[tryname_length]))
tryname_length--;
-@@ -1256,12 +1257,12 @@
+@@ -1256,12 +1256,12 @@ ZEND_DLEXPORT zend_op_array* eaccelerato
int nreloads;
time_t compile_time;
int stat_result = 0;
@@ -26,3 +89,54 @@
ea_debug_printf(EA_TEST_PERFORMANCE, "[%d] Enter COMPILE\n",getpid());
ea_debug_start_time(&tv_start);
ea_debug_printf(EA_DEBUG, "[%d] Enter COMPILE\n",getpid());
+@@ -1565,18 +1565,20 @@ static void profile_execute(zend_op_arra
+
+ for (i=0;i<EAG(profile_level);i++)
+ ea_debug_put(EA_PROFILE_OPCODES, " ");
+- ea_debug_printf(EA_PROFILE_OPCODES, "enter: %s:%s\n", op_array->filename, op_array->function_name);
++ ea_debug_printf(EA_PROFILE_OPCODES, "enter profile_execute: %s:%s\n", op_array->filename, op_array->function_name);
+ ea_debug_start_time(&tv_start);
+ EAG(self_time)[EAG(profile_level)] = 0;
+ EAG(profile_level)++;
++ ea_debug_printf(EA_PROFILE_OPCODES, "About to enter zend_execute...\n");
+ mm_saved_zend_execute(op_array TSRMLS_CC);
++ ea_debug_printf(EA_PROFILE_OPCODES, "Finished zend_execute...\n");
+ usec = ea_debug_elapsed_time(&tv_start);
+ EAG(profile_level)--;
+ if (EAG(profile_level) > 0)
+ EAG(self_time)[EAG(profile_level)-1] += usec;
+ for (i=0;i<EAG(profile_level);i++)
+ ea_debug_put(EA_PROFILE_OPCODES, " ");
+- ea_debug_printf(EA_PROFILE_OPCODES, "leave: %s:%s (%ld,%ld)\n", op_array->filename, op_array->function_name, usec, usec-EAG(self_time)[EAG(profile_level)]);
++ ea_debug_printf(EA_PROFILE_OPCODES, "leave profile_execute: %s:%s (%ld,%ld)\n", op_array->filename, op_array->function_name, usec, usec-EAG(self_time)[EAG(profile_level)]);
+ }
+
+ ZEND_DLEXPORT zend_op_array* profile_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) {
+@@ -1593,7 +1595,7 @@ ZEND_DLEXPORT zend_op_array* profile_com
+ EAG(self_time)[EAG(profile_level)-1] += usec;
+ for (i=0;i<EAG(profile_level);i++)
+ ea_debug_put(EA_PROFILE_OPCODES, " ");
+- ea_debug_printf(EA_DEBUG, "compile: %s (%ld)\n", file_handle->filename, usec);
++ ea_debug_printf(EA_DEBUG, "zend_op_array compile: %s (%ld)\n", file_handle->filename, usec);
+ return t;
+ }
+
+@@ -2023,9 +2025,16 @@ PHP_MINIT_FUNCTION(eaccelerator) {
+
+ if (init_mm(TSRMLS_C) == FAILURE) {
+ zend_error(E_CORE_WARNING,"[%s] Can not create shared memory area", EACCELERATOR_EXTENSION_NAME);
+- return FAILURE;
++ /* disable eA */
++ eaccelerator_mm_instance->enabled = 0;
+ }
+-
++#if 0
++ if (!eaccelerator_scripts_shm_only && check_cache_dir(EAG(cache_dir)) == FAILURE) {
++ zend_error(E_CORE_WARNING,"[%s] Can not init the cache directory", EACCELERATOR_EXTENSION_NAME);
++ /* disable eA */
++ eaccelerator_mm_instance->enabled = 0;
++ }
++#endif
+ mm_saved_zend_compile_file = zend_compile_file;
+
+ #ifdef DEBUG
diff --git a/www/eaccelerator/files/patch-eaccelerator.h b/www/eaccelerator/files/patch-eaccelerator.h
new file mode 100644
index 000000000000..9e5bd9982eaf
--- /dev/null
+++ b/www/eaccelerator/files/patch-eaccelerator.h
@@ -0,0 +1,124 @@
+--- eaccelerator.h.orig Mon Jul 11 19:25:38 2005
++++ eaccelerator.h Thu Feb 2 09:40:00 2006
+@@ -44,6 +44,10 @@
+ # endif
+ #endif
+
++#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1
++# define ZEND_ENGINE_2_1
++#endif
++
+ /* fixes compile errors on php5.1 */
+ #ifdef STR_EMPTY_ALLOC
+ #define empty_string STR_EMPTY_ALLOC()
+@@ -166,12 +170,14 @@
+
+ #define MAX_DUP_STR_LEN 256
+
++/******************************************************************************/
++
++#endif /* HAVE_EACCELERATOR_STANDALONE_LOADER */
++
+ #ifndef offsetof
+ # define offsetof(str,fld) ((size_t)&(((str*)NULL)->fld))
+ #endif
+
+-/******************************************************************************/
+-
+ typedef struct _eaccelerator_op_array {
+ zend_uchar type;
+ #ifdef ZEND_ENGINE_2
+@@ -197,6 +203,10 @@ typedef struct _eaccelerator_op_array {
+ #endif
+ zend_op *opcodes;
+ zend_uint last;
++#ifdef ZEND_ENGINE_2_1
++ zend_compiled_variable *vars;
++ int last_var;
++#endif
+ zend_uint T;
+ zend_brk_cont_element *brk_cont_array;
+ zend_uint last_brk_cont;
+@@ -218,24 +228,29 @@ typedef struct _eaccelerator_class_entry
+ char type;
+ char *name;
+ char *name_lc;
+- uint name_length;
++ zend_uint name_length;
+ char *parent;
+ HashTable function_table;
+ HashTable default_properties;
+ #ifdef ZEND_ENGINE_2
+- zend_uint ce_flags;
+- HashTable *static_members;
+ HashTable properties_info;
++# ifdef ZEND_ENGINE_2_1
++ HashTable default_static_members;
++# endif
++ HashTable *static_members;
+ HashTable constants_table;
++ zend_uint ce_flags;
+ zend_uint num_interfaces;
++
+ char **interfaces;
+ zend_class_iterator_funcs iterator_funcs;
+
+- zend_object_value (*create_object) (zend_class_entry *
+- class_type TSRMLS_DC);
+- zend_object_iterator *(*get_iterator) (zend_class_entry * ce,
+- zval * object TSRMLS_DC);
+- int (*interface_gets_implemented) (zend_class_entry * iface, zend_class_entry * class_type TSRMLS_DC); /* a class implements this interface */
++ /* handlers */
++ zend_object_value (*create_object) (zend_class_entry *class_type TSRMLS_DC);
++ zend_object_iterator *(*get_iterator) (zend_class_entry *ce, zval *object TSRMLS_DC);
++ int (*interface_gets_implemented) (zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
++
++ /* hra: serializer callbacks may need to be added here in the future for php 5.1 */
+
+ char *filename;
+ zend_uint line_start;
+@@ -255,6 +270,8 @@ typedef struct _mm_fc_entry {
+ char htabkey[1]; /* must be last element */
+ } mm_fc_entry;
+
++#ifndef HAVE_EACCELERATOR_STANDALONE_LOADER
++
+ /*
+ * A mm_cache_entry is a bucket for one PHP script file.
+ * Nested functions and classes which defined in the file goes
+@@ -381,17 +398,13 @@ void *eaccelerator_malloc2 (size_t size
+ unsigned int eaccelerator_crc32 (const char *p, size_t n);
+ int eaccelerator_md5 (char *s, const char *prefix, const char *key TSRMLS_DC);
+
+-void restore_zval (zval * TSRMLS_DC);
+ void calc_zval (zval * z TSRMLS_DC);
+ void store_zval (zval * z TSRMLS_DC);
+ void fixup_zval (zval * z TSRMLS_DC);
++void restore_zval (zval * TSRMLS_DC);
+
+ unsigned int hash_mm(const char *data, int len);
+
+-# ifdef WITH_EACCELERATOR_EXECUTOR
+-ZEND_DLEXPORT void eaccelerator_execute (zend_op_array * op_array TSRMLS_DC);
+-# endif
+-
+ # ifdef WITH_EACCELERATOR_OPTIMIZER
+ void eaccelerator_optimize (zend_op_array * op_array);
+ # endif
+@@ -399,15 +412,13 @@ void eaccelerator_optimize (zend_op_arra
+ #ifdef WITH_EACCELERATOR_ENCODER
+ PHP_FUNCTION (eaccelerator_encode);
+ #endif
+-#endif /* HAVE_EACCELERATOR_LOADER_STANDALONE */
++#endif /* HAVE_EACCELERATOR_STANDALONE_LOADER */
+
+ #ifdef ZTS
+ # define EAG(v) TSRMG(eaccelerator_globals_id, zend_eaccelerator_globals*, v)
+ #else
+ # define EAG(v) (eaccelerator_globals.v)
+ #endif
+-
+-#define MMCG(v) EAG(v)
+
+ /*
+ * conditional filter
diff --git a/www/eaccelerator/files/patch-encoder.php b/www/eaccelerator/files/patch-encoder.php
index 41aa6dd0bd08..1d98b90b98cf 100644
--- a/www/eaccelerator/files/patch-encoder.php
+++ b/www/eaccelerator/files/patch-encoder.php
@@ -1,5 +1,5 @@
---- encoder.php.orig Mon Dec 27 07:35:20 2004
-+++ encoder.php Wed Jan 19 08:14:49 2005
+--- encoder.php.orig Fri May 6 10:26:43 2005
++++ encoder.php Thu Feb 2 09:39:47 2006
@@ -1,10 +1,12 @@
+#!%%LOCALBASE%%/bin/php -f
+
@@ -16,7 +16,7 @@
echo "Options:\n";
echo "\t-s suffix\n\t\tencode files only with following suffix (default is \"php\")\n";
echo "\t-a\n\t\tencode all files (no by default)\n";
-@@ -16,10 +18,10 @@
+@@ -17,10 +19,10 @@
echo "\t\tfile name. If you encode directory or several files at once\n";
echo "\t\tthen 'target' specifyes an output directory name.\n";
echo "\nExamples:\n";
diff --git a/www/eaccelerator/files/patch-loader.c b/www/eaccelerator/files/patch-loader.c
new file mode 100644
index 000000000000..a0d8d397b9ec
--- /dev/null
+++ b/www/eaccelerator/files/patch-loader.c
@@ -0,0 +1,13 @@
+--- loader.c.orig Wed Aug 3 20:54:32 2005
++++ loader.c Thu Feb 2 09:40:00 2006
+@@ -39,6 +39,10 @@
+ #include "php.h"
+ #include "ea_restore.h"
+ #include <math.h>
++
++#ifdef HAVE_EACCELERATOR_STANDALONE_LOADER
++zend_extension* ZendOptimizer = NULL;
++#endif
+
+ typedef struct loader_data {
+ long version;
diff --git a/www/eaccelerator/files/patch-opcodes.c b/www/eaccelerator/files/patch-opcodes.c
new file mode 100644
index 000000000000..ba17fe0e5662
--- /dev/null
+++ b/www/eaccelerator/files/patch-opcodes.c
@@ -0,0 +1,113 @@
+--- opcodes.c.orig Mon May 16 11:56:42 2005
++++ opcodes.c Thu Feb 2 09:40:00 2006
+@@ -43,11 +43,7 @@
+ # define OP1_VAR_2 OP1_VAR
+ #endif
+
+-#ifdef ZEND_ENGINE_2
+-# define LAST_OPCODE 149
+-#else
+-# define LAST_OPCODE 106
+-#endif
++#define LAST_OPCODE (sizeof(opcodes)/sizeof(opcodes[0]))
+
+ static const opcode_dsc opcodes[] = {
+ OPDEF("NOP", EXT_UNUSED | OP1_UNUSED | OP2_UNUSED | RES_UNUSED), /* 0 */
+@@ -158,16 +154,20 @@ static const opcode_dsc opcodes[] = {
+ OPDEF("INIT_ARRAY", EXT_BIT | OP1_STD | OP2_STD | RES_TMP), /* 71 */
+ OPDEF("ADD_ARRAY_ELEMENT", EXT_BIT | OP1_STD | OP2_STD | RES_TMP), /* 72 */
+ OPDEF("INCLUDE_OR_EVAL", EXT_UNUSED | OP1_STD | OP2_INCLUDE| RES_VAR), /* 73 */
+-#ifdef ZEND_ENGINE_2
++#ifdef ZEND_ENGINE_2_1
++ /* php 5.1 and up */
+ OPDEF("UNSET_VAR", EXT_UNUSED | OP1_STD | OP2_FETCH | RES_UNUSED), /* 74 */
+- OPDEF("UNSET_DIM_OBJ", EXT_STD | OP1_STD | OP2_STD | RES_UNUSED), /* 75 */
+- OPDEF("ISSET_ISEMPTY", EXT_ISSET | OP1_VAR | OP2_UNUSED | RES_TMP), /* 76 */
++ OPDEF("UNSET_DIM", EXT_STD | OP1_STD | OP2_STD | RES_UNUSED), /* 75 */
++ OPDEF("UNSET_OBJ", EXT_STD | OP1_STD | OP2_STD | RES_UNUSED), /* 76 */
++ OPDEF("FE_RESET", EXT_BIT | OP1_STD | OP2_OPLINE | RES_VAR), /* 77 */
+ #else
++ /* <= php 5.0 */
++ /* though there is no ISSET_ISEMPTY in php 5.0 it's better to leave it here i guess */
+ OPDEF("UNSET_VAR", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_UNUSED), /* 74 */
+ OPDEF("UNSET_DIM_OBJ", EXT_UNUSED | OP1_VAR | OP2_STD | RES_UNUSED), /* 75 */
+ OPDEF("ISSET_ISEMPTY", EXT_UNUSED | OP1_VAR | OP2_ISSET | RES_TMP), /* 76 */
+-#endif
+ OPDEF("FE_RESET", EXT_BIT | OP1_STD | OP2_UNUSED | RES_VAR), /* 77 */
++#endif
+ OPDEF("FE_FETCH", EXT_FE | OP1_STD | OP2_OPLINE | RES_TMP), /* 78 */
+ OPDEF("EXIT", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_UNUSED), /* 79 */
+ OPDEF("FETCH_R", EXT_UNUSED | OP1_STD | OP2_FETCH | RES_VAR), /* 80 */
+@@ -234,7 +234,7 @@ static const opcode_dsc opcodes[] = {
+ OPDEF("POST_INC_OBJ", EXT_UNUSED | OP1_STD | OP2_STD | RES_TMP), /* 134 */
+ OPDEF("POST_DEC_OBJ", EXT_UNUSED | OP1_STD | OP2_STD | RES_TMP), /* 135 */
+ OPDEF("ASSIGN_OBJ", EXT_UNUSED | OP1_STD | OP2_STD | RES_VAR), /* 136 */
+- OPDEF("OP_DATA", EXT_UNUSED | OP1_STD | OP2_STD | RES_UNUSED), /* 137 */
++ OPDEF("OP_DATA", EXT_UNUSED | OP1_STD | OP2_STD | RES_STD), /* 137 */
+ OPDEF("INSTANCEOF", EXT_UNUSED | OP1_STD | OP2_CLASS | RES_TMP), /* 138 */
+ OPDEF("DECLARE_CLASS", EXT_UNUSED | OP1_STD | OP2_STD | RES_CLASS), /* 139 */
+ OPDEF("DECLARE_INHERITED_CLASS", EXT_CLASS | OP1_STD | OP2_STD | RES_CLASS), /* 140 */
+@@ -245,14 +245,17 @@ static const opcode_dsc opcodes[] = {
+ OPDEF("VERIFY_INSTANCEOF", EXT_UNUSED | OP1_CLASS | OP2_STD | RES_UNUSED), /* 145 */
+ OPDEF("VERIFY_ABSTRACT_CLASS", EXT_UNUSED | OP1_CLASS | OP2_UNUSED | RES_UNUSED), /* 146 */
+ OPDEF("ASSIGN_DIM", EXT_UNUSED | OP1_STD | OP2_STD | RES_VAR), /* 147 */
+-
+ OPDEF("ISSET_ISEMPTY_PROP_OBJ", EXT_ISSET | OP1_STD | OP2_STD | RES_TMP), /* 148 */
+ OPDEF("HANDLE_EXCEPTION", EXT_STD | OP1_UNUSED | OP2_UNUSED | RES_STD) /* 149 */
++# ifdef ZEND_ENGINE_2_1
++ ,
++ OPDEF("USER_OPCODE", EXT_STD | OP1_UNUSED | OP2_UNUSED | RES_STD) /* 150 */
++# endif
+ #endif
+ };
+
+ const opcode_dsc* get_opcode_dsc(unsigned int n) {
+- if (n <= LAST_OPCODE) {
++ if (n < LAST_OPCODE) {
+ return &opcodes[n];
+ } else {
+ return NULL;
+@@ -261,17 +264,17 @@ const opcode_dsc* get_opcode_dsc(unsigne
+ #endif
+
+ #ifdef ZEND_ENGINE_2
+-static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE+1];
++static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE];
+ static int handlers_retrived = 0;
+
+ ZEND_DLEXPORT void retrive_opcode_handlers_handler(zend_op_array *op_array) {
+ unsigned char i;
+ efree(op_array->opcodes);
+- op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE+1));
+- op_array->last = LAST_OPCODE+1;
+- op_array->size = LAST_OPCODE+1;
++ op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE));
++ op_array->last = LAST_OPCODE;
++ op_array->size = LAST_OPCODE;
+ op_array->T = 0;
+- for (i=0; i<=LAST_OPCODE; i++) {
++ for (i=0; i<LAST_OPCODE; i++) {
+ op_array->opcodes[i].opcode = i;
+ op_array->opcodes[i].op1.op_type = IS_UNUSED;
+ op_array->opcodes[i].op1.u.opline_num = i;
+@@ -298,9 +301,9 @@ static int retrive_opcode_handlers(TSRML
+ ext->op_array_handler = retrive_opcode_handlers_handler;
+ p = compile_string(&str, empty_string TSRMLS_CC);
+ ext->op_array_handler = old;
+- if (p != NULL && p->last == LAST_OPCODE+1) {
++ if (p != NULL && p->last == (LAST_OPCODE - 1)) {
+ int i = 0;
+- while (i <= LAST_OPCODE) {
++ while (i < LAST_OPCODE) {
+ eaccelerator_opcode_handlers[p->opcodes[i].opcode] = p->opcodes[i].handler;
+ ++i;
+ }
+@@ -318,7 +321,7 @@ opcode_handler_t get_opcode_handler(zend
+ return NULL;
+ }
+ }
+- if (opcode <= LAST_OPCODE) {
++ if (opcode < LAST_OPCODE) {
+ return eaccelerator_opcode_handlers[opcode];
+ } else {
+ return (opcode_handler_t) NULL;
diff --git a/www/eaccelerator/files/patch-optimize.c b/www/eaccelerator/files/patch-optimize.c
new file mode 100644
index 000000000000..52e2286ef6b7
--- /dev/null
+++ b/www/eaccelerator/files/patch-optimize.c
@@ -0,0 +1,217 @@
+--- optimize.c.orig Thu Nov 17 21:25:11 2005
++++ optimize.c Thu Feb 2 09:40:00 2006
+@@ -64,7 +64,6 @@ typedef struct _BBlink {
+ struct _BBlink* next;
+ } BBlink;
+
+-#if 0
+ static void dump_bb(BB* bb, zend_op_array *op_array) {
+ BB* p = bb;
+ BBlink *q;
+@@ -130,7 +129,45 @@ static void dump_bb(BB* bb, zend_op_arra
+ zend_printf("</pre><hr>\n");
+ fflush(stdout);
+ }
+-#endif
++
++static void dump_array(int nb,void *pos,char type)
++{ int j;
++
++ switch(type) {
++ case 'i': {
++ int *ptr=pos;
++ for (j=0;j<nb;j++) {
++ zend_printf("%d:%6d ",j,*ptr);
++ ptr++;
++ }
++ }
++ break;
++ case 'x': {
++ int *ptr=pos;
++ for (j=0;j<nb;j++) {
++ zend_printf("%d:%x ",j,*ptr);
++ ptr++;
++ }
++ }
++ break;
++ case 'c': {
++ unsigned char *ptr=pos;
++ for (j=0;j<nb;j++) {
++/* if (*ptr>=32 && *ptr<128) zend_printf("%d:%c",j,*ptr);
++ else if (*ptr>=128) zend_printf("%d:%2x",j,*ptr);
++ else if (*ptr<16) zend_printf("%d:&%1x",j,*ptr);
++ else zend_printf("%d:$%1x",j,(*ptr)-16); */
++ zend_printf("%d:%1x ",j,*ptr);
++ ptr++;
++ }
++ }
++ break;
++ default:
++ for (j=0;j<nb;j++)
++ zend_printf("# ");
++ }
++ zend_printf("<br>\n");
++}
+
+ #define SET_TO_NOP(op) \
+ (op)->opcode = ZEND_NOP; \
+@@ -250,14 +287,27 @@ static void compute_live_var(BB* bb, zen
+ }
+ break;
+ case ZEND_UNSET_VAR:
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ case ZEND_UNSET_DIM_OBJ:
+ end->result.op_type = IS_UNUSED;
+ break;
++#else
++ case ZEND_UNSET_DIM:
++ case ZEND_UNSET_OBJ:
++ end->result.op_type = IS_UNUSED;
++ break;
++#endif
+ case ZEND_RECV:
+ case ZEND_RECV_INIT:
+ /*case ZEND_ADD_ARRAY_ELEMENT:*/
+ case ZEND_INCLUDE_OR_EVAL:
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ case ZEND_JMP_NO_CTOR:
++#else
++ case ZEND_NEW:
++#endif
+ case ZEND_FE_FETCH:
+ #ifdef ZEND_ENGINE_2
+ case ZEND_ASSIGN_DIM:
+@@ -1279,7 +1329,12 @@ jmp_nz_ex:
+ goto jmp_nz;
+ }
+ goto jmp_2;
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ case ZEND_JMP_NO_CTOR:
++#else
++ case ZEND_NEW:
++#endif
+ case ZEND_FE_FETCH:
+ jmp_2:
+ while (p->jmp_2->len == 1 && p->jmp_2->start->opcode == ZEND_JMP) {
+@@ -1714,6 +1769,7 @@ static void optimize_bb(BB* bb, zend_op_
+ }
+ } else
+ #endif
++
+ if ((op->opcode == ZEND_ADD ||
+ op->opcode == ZEND_SUB ||
+ op->opcode == ZEND_MUL ||
+@@ -2443,7 +2499,13 @@ else if (prev != NULL &&
+ op->opcode == ZEND_DO_FCALL_BY_NAME ||
+ op->opcode == ZEND_POST_INC ||
+ op->opcode == ZEND_POST_DEC ||
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ op->opcode == ZEND_UNSET_DIM_OBJ ||
++#else
++ op->opcode == ZEND_UNSET_DIM ||
++ op->opcode == ZEND_UNSET_OBJ ||
++#endif
+ op->opcode == ZEND_INCLUDE_OR_EVAL
+ #ifdef ZEND_ENGINE_2
+ || op->opcode == ZEND_ASSIGN_DIM
+@@ -2721,7 +2783,13 @@ static int build_cfg(zend_op_array *op_a
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ case ZEND_JMP_NO_CTOR:
++#else
++ case ZEND_NEW:
++ case ZEND_FE_RESET:
++#endif
+ case ZEND_FE_FETCH:
+ bb[line_num+1].start = op+1;
+ bb[op->op2.u.opline_num].start = &op_array->opcodes[op->op2.u.opline_num];
+@@ -2840,9 +2908,19 @@ cont_failed:
+ break;
+ #endif
+ case ZEND_UNSET_VAR:
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ case ZEND_UNSET_DIM_OBJ:
+ op->result.op_type = IS_UNUSED;
+ break;
++#else
++ case ZEND_UNSET_DIM:
++ op->result.op_type = IS_UNUSED;
++ break;
++ case ZEND_UNSET_OBJ:
++ op->result.op_type = IS_UNUSED;
++ break;
++#endif
+ default:
+ break;
+ }
+@@ -2894,7 +2972,13 @@ cont_failed:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
++#ifndef ZEND_ENGINE_2_1
++/* Pre-PHP 5.1 only */
+ case ZEND_JMP_NO_CTOR:
++#else
++ case ZEND_NEW:
++ case ZEND_FE_RESET:
++#endif
+ case ZEND_FE_FETCH:
+ p->jmp_2 = &bb[op->op2.u.opline_num];
+ p->follow = &bb[line_num];
+@@ -3109,6 +3193,7 @@ void reassign_registers(zend_op_array *o
+
+ while (start < op) {
+ --op;
++ /* zend_printf("op=%d\n", op-op_array->opcodes); */
+ #ifdef ZEND_ENGINE_2
+ op_data = NULL;
+ #else
+@@ -3151,20 +3236,6 @@ void reassign_registers(zend_op_array *o
+ GET_REG(r);
+ op->extended_value = VAR_VAL(assigned[r]);
+ }
+- if (op->opcode == ZEND_OP_DATA) {
+- op_data = op;
+- --op;
+- if (op->op1.op_type == IS_VAR || op->op1.op_type == IS_TMP_VAR) {
+- int r = VAR_NUM(op->op1.u.var);
+- GET_REG(r);
+- op->op1.u.var = VAR_VAL(assigned[r]);
+- }
+- if (op->op2.op_type == IS_VAR || op->op2.op_type == IS_TMP_VAR) {
+- int r = VAR_NUM(op->op2.u.var);
+- GET_REG(r);
+- op->op2.u.var = VAR_VAL(assigned[r]);
+- }
+- }
+ #endif
+ if (op->result.op_type == IS_VAR ||
+ op->result.op_type == IS_TMP_VAR) {
+@@ -3192,11 +3263,6 @@ void reassign_registers(zend_op_array *o
+ }
+ }
+ }
+-#ifdef ZEND_ENGINE_2
+- if (op_data != NULL && op_data->op2.op_type == IS_VAR) {
+- FREE_REG(VAR_NUM(op_data->op2.u.var));
+- }
+-#endif
+ }
+ }
+ p = p->next;
+@@ -3279,6 +3345,7 @@ void eaccelerator_optimize(zend_op_array
+ /* Store Optimized Code */
+ emit_cfg(op_array, bb);
+ reassign_registers(op_array, bb, global);
++ /* dump_bb(bb, op_array); */
+
+ free_alloca(global);
+ }
diff --git a/www/eaccelerator/files/patch-webui.c b/www/eaccelerator/files/patch-webui.c
new file mode 100644
index 000000000000..405562787eb2
--- /dev/null
+++ b/www/eaccelerator/files/patch-webui.c
@@ -0,0 +1,204 @@
+--- webui.c.orig Sun Jul 10 10:12:33 2005
++++ webui.c Thu Feb 2 09:40:00 2006
+@@ -263,7 +263,7 @@ static void dump_zval (zval * v, int com
+ ZEND_PUTS ("constant('");
+ goto string_dump;
+ case IS_CONSTANT_ARRAY:
+- ZEND_PUTS ("constatnt_array(");
++ ZEND_PUTS ("constant_array(");
+ goto array_dump;
+ default:
+ zend_printf ("unknown(%d)", v->type);
+@@ -271,21 +271,26 @@ static void dump_zval (zval * v, int com
+ }
+
+ static const char *color_list[] = {
+- "#FF0000",
+- "#00FF00",
+- "#0000FF",
+- "#FFFF00",
+- "#00FFFF",
+- "#FF00FF",
+- "#800000",
+- "#008000",
+- "#000080",
+- "#808000",
+- "#008080",
+- "#800080"
++ /* color from irc */
++ /* 0 // "#ffffff", white */
++ /* 1 // "#000000", black */
++ /* 4 */ "#ff0000", /* light red */
++ /* 7 */ "#fc7f00", /* orange */
++ /* 6 */ "#9c009c", /* magenta */
++ /* 5 */ "#7f0000", /* red */
++ /* 9 */ "#00fc00", /* light green (lime) */
++ /* 10 */ "#009393", /* cyan */
++ /* 12 */ "#0000fc", /* light blue */
++ /* 13 */ "#ff00ff", /* light magenta (pink) */
++ /* 2 */ "#00007f", /* blue */
++ /* 3 */ "#009300", /* green */
++ /* 8 // "#ffff00", yellow */
++ /* 11 // "#00ffff", light cyan (aqua) */
++ /* 14 */ "#7f7f7f", /* grey */
++ /* 15 */ "#d2d2d2" /* light grey (silver) */
+ };
+
+-static char const *color (int num)
++static const char *color (int num)
+ {
+ return color_list[num % (sizeof (color_list) / sizeof (char *))];
+ }
+@@ -322,6 +327,11 @@ static void print_file_line (char *p, in
+ while (line > 0 && *p) {
+ if (*p == '\n') {
+ line--;
++ } else if (*p == '\r') {
++ line--;
++ if (p[1] == '\n') {
++ p++;
++ }
+ } else if (line == 1) {
+ if (*p == '<')
+ zend_printf ("&lt;");
+@@ -343,6 +353,9 @@ static void dump_op_array (eaccelerator_
+ unsigned last_line = 0;
+
+ #ifdef ZEND_ENGINE_2
++#ifdef ZEND_ENGINE_2_1
++ zend_printf ("last_var = %u, ", p->last_var);
++#endif
+ zend_printf ("T = %u, size = %u\n, brk_count = %u, file = %s<br>\n",
+ p->T, p->last, p->last_brk_cont, p->filename);
+ #else
+@@ -367,9 +380,25 @@ static void dump_op_array (eaccelerator_
+ ZEND_PUTS ("&nbsp;</td></tr>\n");
+ q = q->pListNext;
+ }
+- ZEND_PUTS ("<tbody></table><br>\n");
++ ZEND_PUTS ("</tbody></table><br>\n");
+ }
+-
++#ifdef ZEND_ENGINE_2_1
++ if (p->last_var) {
++ int i;
++
++ ZEND_PUTS("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"600\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n");
++ ZEND_PUTS("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"200\">Compiled variable</th><th width=\"200\">Len</th><th width=\"200\">Hash</th></tr></thead>\n");
++ ZEND_PUTS("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all\">\n");
++
++ for (i = 0; i < p->last_var; i ++) {
++ zend_printf ("<tr><td bgcolor=\"#ccccff\">$%s&nbsp;</td>", p->vars[i].name);
++ zend_printf ("<td bgcolor=\"#ccccff\">%u&nbsp;</td>", p->vars[i].name_len);
++ zend_printf ("<td bgcolor=\"#ccccff\">%u&nbsp;</td></tr>\n", p->vars[i].hash_value);
++ }
++ ZEND_PUTS ("</tbody></table><br>\n");
++ }
++#endif
++
+ if (p->opcodes) {
+ int n = 0;
+ opline = p->opcodes;
+@@ -377,20 +406,20 @@ static void dump_op_array (eaccelerator_
+
+ filebuf = get_file_contents (p->filename);
+
+- ZEND_PUTS
+- ("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"900\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n");
+- ZEND_PUTS
+- ("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"40\">N</th><th width=\"160\">OPCODE</th><th width=\"160\">EXTENDED_VALUE</th><th width=\"220\">OP1</th><th width=\"220\">OP2</th><th width=\"80\">RESULT</th></tr></thead>\n");
+- ZEND_PUTS
+- ("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all; font-size: x-small\">\n");
++ ZEND_PUTS("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"900\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n");
++ ZEND_PUTS("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"40\">N</th><th width=\"160\">OPCODE</th><th width=\"160\">EXTENDED_VALUE</th><th width=\"220\">OP1</th><th width=\"220\">OP2</th><th width=\"80\">RESULT</th></tr></thead>\n");
++ ZEND_PUTS("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all; font-size: x-small\">\n");
++
+ for (; opline < end; opline++) {
+ const opcode_dsc *op = get_opcode_dsc (opline->opcode);
+
+- while (last_line < opline->lineno) {
+- last_line++;
+- zend_printf
+- ("<tr><td colspan=6 bgcolor=black><pre><font color=#80ff80>");
+- print_file_line (filebuf, last_line);
++ if (last_line < opline->lineno) {
++ zend_printf("<tr><td colspan=6 bgcolor=black><pre><font color=#80ff80>");
++ while (last_line < opline->lineno) {
++ last_line++;
++ print_file_line(filebuf, last_line);
++ ZEND_PUTS("\n");
++ }
+ zend_printf ("</font></pre></td></tr>\n");
+ }
+
+@@ -459,6 +488,7 @@ static void dump_op_array (eaccelerator_
+ } else {
+ ZEND_PUTS ("<td>&nbsp; </td>");
+ }
++#ifndef ZEND_ENGINE_2_1
+ } else if (opline->opcode == ZEND_UNSET_DIM_OBJ) {
+ if (opline->extended_value == ZEND_UNSET_DIM) {
+ ZEND_PUTS ("<td>ZEND_UNSET_DIM </td>");
+@@ -468,6 +498,7 @@ static void dump_op_array (eaccelerator_
+ ZEND_PUTS ("<td>&nbsp; </td>");
+ }
+ #endif
++#endif
+ } else if (opline->extended_value != 0) {
+ zend_printf ("<td>%ld </td>", opline->extended_value);
+ } else {
+@@ -479,7 +510,13 @@ static void dump_op_array (eaccelerator_
+ n, opline->opcode, opline->extended_value);
+ op = get_opcode_dsc (0);
+ }
+-
++#ifdef ZEND_ENGINE_2_1
++ if (opline->op1.op_type == IS_CV) {
++ zend_printf("<td><font color=%s>$cv%u(%s)</font> </td>",
++ color (opline->op1.u.var), opline->op1.u.var,
++ p->vars[opline->op1.u.var].name);
++ } else
++#endif
+ if ((op->ops & OP1_MASK) == OP1_OPLINE) {
+ zend_printf
+ ("<td><font color=%s>opline(%d)</font> </td>",
+@@ -586,7 +623,13 @@ static void dump_op_array (eaccelerator_
+ ("<td>UNKNOWN NODE %d </td>", opline->op1.op_type);
+ }
+ }
+-
++#ifdef ZEND_ENGINE_2_1
++ if (opline->op2.op_type == IS_CV) {
++ zend_printf("<td><font color=%s>$cv%u(%s)</font> </td>",
++ color (opline->op2.u.var), opline->op2.u.var,
++ p->vars[opline->op2.u.var].name);
++ } else
++#endif
+ if ((op->ops & OP2_MASK) == OP2_OPLINE) {
+ zend_printf
+ ("<td><font color=%s>opline(%d)</font> </td>",
+@@ -674,7 +717,14 @@ static void dump_op_array (eaccelerator_
+ ("<td>UNKNOWN NODE %d </td>", opline->op2.op_type);
+ }
+ }
+-
++#ifdef ZEND_ENGINE_2_1
++ if (opline->result.op_type == IS_CV) {
++ zend_printf("<td><font color=%s>$cv%u(%s)</font> </td>",
++ color (opline->result.u.var), opline->result.u.var,
++ p->vars[opline->result.u.var].name);
++ } else
++#endif
++
+ switch (op->ops & RES_MASK) {
+ case RES_STD:
+ if (opline->result.op_type == IS_CONST) {
+@@ -1833,7 +1883,7 @@ PHP_FUNCTION (eaccelerator)
+ }
+
+ {
+- char *s = php_get_uname ();
++ char *s = php_get_uname ('a');
+ zend_printf ("<nobr>%s</nobr>\n", s);
+ efree (s);
+ }
diff --git a/www/eaccelerator/pkg-plist b/www/eaccelerator/pkg-plist
index d94827ec5535..a76ab61405a6 100644
--- a/www/eaccelerator/pkg-plist
+++ b/www/eaccelerator/pkg-plist
@@ -1,4 +1,4 @@
-bin/encoder
+%%ENCODER%%bin/encoder
lib/php/%%PHP_EXT_DIR%%/eaccelerator.so
@dirrmtry lib/php/%%PHP_EXT_DIR%%
%%EXAMPLESDIR%%/eaccelerator.ini