summaryrefslogtreecommitdiff
blob: 6a77dcc5667598be1c1d75721ec595cee6128415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
Removing the encoder which has a security issue and is deprectated by upstream anyway. Bug 277293.
Changes from upstream SVN r246, backported by a3li@gentoo.org.
Note the rm'ed files in the ebuild, too.

diff -Naur a/config.m4 b/config.m4
--- a/config.m4	2007-05-16 21:07:31.000000000 +0200
+++ b/config.m4	2009-08-13 18:54:15.759128874 +0200
@@ -29,20 +29,6 @@
   eaccelerator_optimizer=yes
 ])
 
-AC_ARG_WITH(eaccelerator-encoder,
-[  --without-eaccelerator-encoder           Do not include eaccelerator encoder],[
-  eaccelerator_encoder=$withval
-],[
-  eaccelerator_encoder=yes
-])
-
-AC_ARG_WITH(eaccelerator-loader,
-[  --without-eaccelerator-loader            Do not include eaccelerator loader],[
-  eaccelerator_loader=$withval
-],[
-  eaccelerator_loader=yes
-])
-
 AC_ARG_WITH(eaccelerator-shared-memory,
 [  --with-eaccelerator-shared-memory        Include eaccelerator shared memory functions],[
   eaccelerator_shm=$withval
@@ -124,12 +110,6 @@
   if test "$eaccelerator_optimizer" = "yes"; then
     AC_DEFINE(WITH_EACCELERATOR_OPTIMIZER, 1, [Define if you like to use peephole opcode optimization])
   fi
-  if test "$eaccelerator_encoder" = "yes"; then
-    AC_DEFINE(WITH_EACCELERATOR_ENCODER, 1, [Define if you like to use eAccelerator enoder])
-  fi
-  if test "$eaccelerator_loader" = "yes"; then
-    AC_DEFINE(WITH_EACCELERATOR_LOADER, 1, [Define if you like to load files encoded by eAccelerator encoder])
-  fi
   if test "$eaccelerator_shm" = "yes"; then
     AC_DEFINE(WITH_EACCELERATOR_SHM, 1, [Define if you like to use the eAccelerator functions to store keys in shared memory])
   fi
diff -Naur a/eaccelerator.c b/eaccelerator.c
--- a/eaccelerator.c	2008-05-18 11:04:20.000000000 +0200
+++ b/eaccelerator.c	2009-08-13 18:54:15.759128874 +0200
@@ -1408,52 +1408,6 @@
          ((stat(file_handle->opened_path, &buf) == 0) && S_ISREG(buf.st_mode)))) {
       DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: storing in cache (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start)));
       DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: storing in cache\n", getpid()));
-#ifdef WITH_EACCELERATOR_LOADER
-      if (t->last >= 3 &&
-          t->opcodes[0].opcode == ZEND_SEND_VAL &&
-          t->opcodes[1].opcode == ZEND_DO_FCALL &&
-          t->opcodes[2].opcode == ZEND_RETURN &&
-          t->opcodes[1].op1.op_type == IS_CONST &&
-          t->opcodes[1].op1.u.constant.type == IS_STRING &&
-          t->opcodes[1].op1.u.constant.value.str.len == sizeof("eaccelerator_load")-1 &&
-          (memcmp(t->opcodes[1].op1.u.constant.value.str.val, "eaccelerator_load", sizeof("eaccelerator_load")-1) == 0) &&
-          t->opcodes[0].op1.op_type == IS_CONST &&
-          t->opcodes[0].op1.u.constant.type == IS_STRING) {
-        zend_op_array* new_t = NULL;
-        zend_bool old_in_compilation = CG(in_compilation);
-        char* old_filename = CG(compiled_filename);
-        int old_lineno = CG(zend_lineno);
-
-        CG(in_compilation) = 1;
-        zend_set_compiled_filename(t->filename TSRMLS_CC);
-        CG(zend_lineno) = t->opcodes[1].lineno;
-
-        zend_try {
-          new_t = eaccelerator_load(
-            t->opcodes[0].op1.u.constant.value.str.val,
-            t->opcodes[0].op1.u.constant.value.str.len TSRMLS_CC);
-        } zend_catch {
-            CG(function_table)	= orig_function_table;
-            CG(class_table)		= orig_class_table;
-            ea_bailout				= 1;
-        } zend_end_try();
-        if (ea_bailout) {
-          zend_bailout ();
-        }
-        CG(in_compilation) = old_in_compilation;
-        CG(compiled_filename) = old_filename;
-        CG(zend_lineno) = old_lineno;
-        if (new_t != NULL) {
-#ifdef ZEND_ENGINE_2
-          destroy_op_array(t TSRMLS_CC);
-#else
-          destroy_op_array(t);
-#endif
-          efree(t);
-          t = new_t;
-        }
-      }
-#endif
       function_table_tail = function_table_tail?function_table_tail->pListNext:CG(function_table)->pListHead;
       class_table_tail = class_table_tail?class_table_tail->pListNext:CG(class_table)->pListHead;
       if (eaccelerator_store(file_handle->opened_path, &buf, nreloads, t, function_table_tail, class_table_tail TSRMLS_CC)) {
@@ -1907,7 +1861,6 @@
   eaccelerator_globals->cache_dir         = NULL;
   eaccelerator_globals->optimizer_enabled = 1;
   eaccelerator_globals->compiler          = 0;
-  eaccelerator_globals->encoder           = 0;
   eaccelerator_globals->cond_list         = NULL;
   eaccelerator_globals->content_headers   = NULL;
 #ifdef WITH_EACCELERATOR_SESSIONS
@@ -1986,15 +1939,6 @@
       }
     }
 #endif
-#ifdef WITH_EACCELERATOR_LOADER
-    if (zend_hash_exists(&module_registry, EACCELERATOR_LOADER_EXTENSION_NAME, 
-                sizeof(EACCELERATOR_LOADER_EXTENSION_NAME))) {
-      zend_error(E_CORE_WARNING,"Extension \"%s\" is not need with \"%s\". Remove it from php.ini\n", 
-              EACCELERATOR_LOADER_EXTENSION_NAME, EACCELERATOR_EXTENSION_NAME);
-      zend_hash_del(&module_registry, EACCELERATOR_LOADER_EXTENSION_NAME, 
-              sizeof(EACCELERATOR_LOADER_EXTENSION_NAME));
-    }
-#endif
   }
   if (!eaccelerator_check_php_version(TSRMLS_C)) {
     return FAILURE;
@@ -2115,7 +2059,6 @@
 	EAG(in_request) = 1;
 	EAG(used_entries) = NULL;
 	EAG(compiler) = 0;
-	EAG(encoder) = 0;
 	EAG(refcount_helper) = 1;
 	EAG(compress_content) = 1;
 	EAG(content_headers) = NULL;
@@ -2242,14 +2185,6 @@
   PHP_FE(eaccelerator_removed_scripts, NULL)
   PHP_FE(eaccelerator_list_keys, NULL)
 #endif
-#ifdef WITH_EACCELERATOR_ENCODER
-  PHP_FE(eaccelerator_encode, eaccelerator_second_arg_force_ref)
-#endif
-#ifdef WITH_EACCELERATOR_LOADER
-  PHP_FE(eaccelerator_load, NULL)
-  PHP_FE(_eaccelerator_loader_file, NULL)
-  PHP_FE(_eaccelerator_loader_line, NULL)
-#endif
 #ifdef WITH_EACCELERATOR_SESSIONS
 #ifndef HAVE_PHP_SESSIONS_SUPPORT
   PHP_FE(_eaccelerator_session_open, NULL)
diff -Naur a/eaccelerator.h b/eaccelerator.h
--- a/eaccelerator.h	2007-05-16 21:07:31.000000000 +0200
+++ b/eaccelerator.h	2009-08-13 18:54:15.751121331 +0200
@@ -117,7 +117,6 @@
 #endif
 
 #ifdef HAVE_EACCELERATOR
-#ifndef HAVE_EACCELERATOR_STANDALONE_LOADER 
 
 #include "mm.h"
 
@@ -185,7 +184,6 @@
 
 /******************************************************************************/
 
-#endif /* HAVE_EACCELERATOR_STANDALONE_LOADER */
 
 #ifndef offsetof
 #  define offsetof(str,fld) ((size_t)&(((str*)NULL)->fld))
@@ -275,7 +273,6 @@
 	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.
@@ -423,11 +420,6 @@
 void eaccelerator_optimize (zend_op_array * op_array);
 #  endif
 
-#ifdef WITH_EACCELERATOR_ENCODER
-PHP_FUNCTION (eaccelerator_encode);
-#endif
-#endif /* HAVE_EACCELERATOR_STANDALONE_LOADER */
-
 #ifdef ZTS
 #  define EAG(v) TSRMG(eaccelerator_globals_id, zend_eaccelerator_globals*, v)
 #else
@@ -444,13 +436,6 @@
 	struct _mm_cond_entry *next;
 } mm_cond_entry;
 
-#ifdef WITH_EACCELERATOR_LOADER
-zend_op_array *eaccelerator_load (char *src, int src_len TSRMLS_DC);
-PHP_FUNCTION (eaccelerator_load);
-PHP_FUNCTION (_eaccelerator_loader_file);
-PHP_FUNCTION (_eaccelerator_loader_line);
-#endif
-
 /*
  * Globals (different for each process/thread)
  */
@@ -461,7 +446,6 @@
 zend_bool optimizer_enabled;
 zend_bool compression_enabled;
 zend_bool compiler;
-zend_bool encoder;
 zend_bool compress;
 zend_bool compress_content;
 zend_bool in_request;
@@ -508,16 +492,9 @@
 ZEND_EXTERN_MODULE_GLOBALS (eaccelerator)
 
 #define EACCELERATOR_EXTENSION_NAME "eAccelerator"
-#define EACCELERATOR_LOADER_EXTENSION_NAME "eLoader"
 
 #define EA_MAGIC "EACCELERATOR"
 
-#define EA_ENCODER_VERSION   0x00000004
-#define EA_ENCODER_END       0x00
-#define EA_ENCODER_NAMESPACE 0x01
-#define EA_ENCODER_CLASS     0x02
-#define EA_ENCODER_FUNCTION  0x03
-
 #define EACCELERATOR_VERSION_GUID   "PHPE8EDA1B6-806A-4851-B1C8-A6B4712F44FB"
 #define EACCELERATOR_LOGO_GUID      "PHPE6F78DE9-13E4-4dee-8518-5FA2DACEA803"
 #define EACCELERATOR_VERSION_STRING ("eAccelerator " EACCELERATOR_VERSION " (PHP " PHP_VERSION ")")
diff -Naur a/ea_store.c b/ea_store.c
--- a/ea_store.c	2007-05-16 21:07:31.000000000 +0200
+++ b/ea_store.c	2009-08-13 18:54:15.755134601 +0200
@@ -42,9 +42,8 @@
 #endif
 static void calc_string(char *str, int len TSRMLS_DC)
 {
-	if (len > MAX_DUP_STR_LEN || zend_hash_add(&EAG(strings), str, len,
-											   &str, sizeof(char *),
-											   NULL) == SUCCESS) {
+	if (len > MAX_DUP_STR_LEN || 
+            zend_hash_add(&EAG(strings), str, len, &str, sizeof(char *), NULL) == SUCCESS) {
 		EACCELERATOR_ALIGN(EAG(mem));
 		EAG(mem) += len;
 	}
@@ -360,7 +359,6 @@
 	return (size_t) EAG(mem);
 }
 
-/** Functions to store a script **/
 static inline char *store_string(char *str, int len TSRMLS_DC)
 {
 	char *p;
diff -Naur a/Makefile.in b/Makefile.in
--- a/Makefile.in	2007-05-16 21:07:31.000000000 +0200
+++ b/Makefile.in	2009-08-13 18:54:15.755134601 +0200
@@ -1,5 +1,5 @@
 LTLIBRARY_NAME        = libeaccelerator.la
-LTLIBRARY_SOURCES     = eaccelerator.c optimize.c encoder.c loader.c opcodes.c content.c mm.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c ea_info.c ea_dasm.c
+LTLIBRARY_SOURCES     = eaccelerator.c optimize.c opcodes.c content.c mm.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c ea_info.c ea_dasm.c
 LTLIBRARY_SHARED_NAME = eaccelerator.la
 
 EXTRA_CFLAGS = -O2 -g -Wall 
diff -Naur a/optimize.c b/optimize.c
--- a/optimize.c	2007-08-14 13:14:00.000000000 +0200
+++ b/optimize.c	2009-08-13 18:54:15.755134601 +0200
@@ -1496,88 +1496,77 @@
 }
 
 static int opt_get_constant(const char* name, int name_len, zend_constant** result TSRMLS_DC) {
-  if (!EAG(encoder) ||
-      (name_len == sizeof("false")-1 && strcmp(name,"false") == 0) ||
-      (name_len == sizeof("true")-1 && strcmp(name,"true") == 0)) {
-    union {
-      zend_constant *v;
-      void *ptr;
-    } c;
-    int retval;
-    char *lookup_name = do_alloca(name_len+1);
-    memcpy(lookup_name, name, name_len);
-    lookup_name[name_len] = '\0';
+  union {
+    zend_constant *v;
+    void *ptr;
+  } c;
+  int retval;
+  char *lookup_name = do_alloca(name_len+1);
+  memcpy(lookup_name, name, name_len);
+  lookup_name[name_len] = '\0';
+
+  if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) {
+    *result = c.v;
+    retval=1;
+  } else {
+    zend_str_tolower(lookup_name, name_len);
 
     if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) {
-      *result = c.v;
-      retval=1;
-    } else {
-      zend_str_tolower(lookup_name, name_len);
-
-      if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) {
-        if ((c.v->flags & CONST_CS) && (memcmp(c.v->name, name, name_len)!=0)) {
-          retval=0;
-        } else {
-          *result = c.v;
-          retval=1;
-        }
-      } else {
+      if ((c.v->flags & CONST_CS) && (memcmp(c.v->name, name, name_len)!=0)) {
         retval=0;
+      } else {
+        *result = c.v;
+        retval=1;
       }
+    } else {
+      retval=0;
     }
-    free_alloca(lookup_name);
-    return retval;
-  } else {
-    return 0;
   }
+  free_alloca(lookup_name);
+  return retval;
 }
 
 static int opt_function_exists(const char* name, int name_len TSRMLS_DC) {
-  if (!EAG(encoder)) {
-    char *lcname;
-    char *lcfname;
-    Bucket *p;
-
-    lcname = estrndup(name,name_len+1);
-    zend_str_tolower(lcname, name_len);
-    p = module_registry.pListHead;
-    while (p != NULL) {
-      zend_module_entry *m = (zend_module_entry*)p->pData;
-      if (m->type == MODULE_PERSISTENT) {
-        zend_function_entry* f = m->functions;
-        if (f != NULL) {
-          while (f->fname) {
-            lcfname = estrdup(f->fname);
-            zend_str_tolower(lcfname, strlen(lcfname));
-            if (strcmp(lcname,lcfname) == 0) {
-              efree(lcfname);
-              efree(lcname);
-              return 1;
-            }
-            efree(lcfname);
-            f++;
-          }
+  char *lcname;
+  char *lcfname;
+  Bucket *p;
+
+  lcname = estrndup(name,name_len+1);
+  zend_str_tolower(lcname, name_len);
+  p = module_registry.pListHead;
+  while (p != NULL) {
+    zend_module_entry *m = (zend_module_entry*)p->pData;
+    if (m->type == MODULE_PERSISTENT) {
+      zend_function_entry* f = m->functions;
+      if (f != NULL) {
+        while (f->fname) {
+        lcfname = estrdup(f->fname);
+        zend_str_tolower(lcfname, strlen(lcfname));
+        if (strcmp(lcname,lcfname) == 0) {
+          efree(lcfname);
+          efree(lcname);
+          return 1;
+        }
+          efree(lcfname);
+          f++;
         }
       }
-      p = p->pListNext;
     }
-    efree(lcname);
+    p = p->pListNext;
   }
+  efree(lcname);
   return 0;
 }
 
 static int opt_extension_loaded(const char* name, int name_len TSRMLS_DC) {
-  if (!EAG(encoder)) {
-    Bucket *p = module_registry.pListHead;
-    while (p != NULL) {
-      zend_module_entry *m = (zend_module_entry*)p->pData;
-      if (m->type == MODULE_PERSISTENT && strcmp(m->name,name) == 0) {
-        return 1;
-      }
-      p = p->pListNext;
+  Bucket *p = module_registry.pListHead;
+  while (p != NULL) {
+    zend_module_entry *m = (zend_module_entry*)p->pData;
+    if (m->type == MODULE_PERSISTENT && strcmp(m->name,name) == 0) {
+      return 1;
     }
+    p = p->pListNext;
   }
-  return 0;
 }
 
 static int opt_result_is_numeric(zend_op* x) {
diff -Naur a/README b/README
--- a/README	2007-05-16 21:07:31.000000000 +0200
+++ b/README	2009-08-13 18:54:15.759128874 +0200
@@ -19,14 +19,6 @@
 by several engines. Files that can't fit in shared memory are cached  on  disk
 only.
 
-eAccelerator contains a PHP encoder and loader. You  can  encode  PHP  scripts
-using encoder.php in order to distribute them without sources.  Encoded  files 
-can be run on any site which  runs  PHP  with  eAccelerator.  The  sources  of
-encoded scripts can't be restored because they are stored in a  compiled  form
-and the encoded version doesn't contain the source. Of course, some  internals
-of the scripts can  be  restored  with  different  reverse  engineering  tools
-(disassemblers, debuggers, etc), but it is not trivial.
-
 eAccelerator is compatible with Zend Optimizer's loader. Zend  Optimizer  must
 be installed after eAccelerator in php.ini. If you don't use  scripts  encoded
 with  Zend  Encoder  we  do  not  recommend  to  install  Zend  Optimizer with