root/eaccelerator/tags/0.9.3/webui.c

Revision 89, 56.2 kB (checked in by zoeloelip, 3 years ago)

Added some includes to satisfy VC.NET (thanks to dakalka, patch 1198522)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2    +----------------------------------------------------------------------+
3    | eAccelerator project                                                 |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2004 - 2005 eAccelerator                               |
6    | http://eaccelerator.net                                                      |
7    +----------------------------------------------------------------------+
8    | This program is free software; you can redistribute it and/or        |
9    | modify it under the terms of the GNU General Public License          |
10    | as published by the Free Software Foundation; either version 2       |
11    | of the License, or (at your option) any later version.               |
12    |                                                                      |
13    | This program is distributed in the hope that it will be useful,      |
14    | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
15    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
16    | GNU General Public License for more details.                         |
17    |                                                                      |
18    | You should have received a copy of the GNU General Public License    |
19    | along with this program; if not, write to the Free Software          |
20    | Foundation, Inc., 59 Temple Place - Suite 330, Boston,               |
21    | MA  02111-1307, USA.                                                 |
22    |                                                                      |
23    | A copy is availble at http://www.gnu.org/copyleft/gpl.txt            |
24    +----------------------------------------------------------------------+
25    | Author(s): Dmitry Stogov <dstogov@users.sourceforge.net>             |
26    +----------------------------------------------------------------------+
27    $Id$
28 */
29
30 #include "eaccelerator.h"
31 #include "eaccelerator_version.h"
32
33 #ifdef HAVE_EACCELERATOR
34 #ifdef WITH_EACCELERATOR_WEBUI
35
36 #include "webui.h"
37 #include "opcodes.h"
38 #include "cache.h"
39 #include "mm.h"
40
41 #include "zend.h"
42 #include "zend_API.h"
43 #include "zend_extensions.h"
44
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #ifdef ZEND_WIN32
48 #  include "win32/time.h"
49 #  include <time.h>
50 #  include <sys/utime.h>
51 #else
52 #  include <sys/file.h>
53 #  include <sys/time.h>
54 #  include <utime.h>
55 #endif
56 #include <fcntl.h>
57
58 #ifndef O_BINARY
59 #  define O_BINARY 0
60 #endif
61
62 #include "SAPI.h"
63
64 extern eaccelerator_mm *eaccelerator_mm_instance;
65 PHPAPI char *php_get_uname();
66
67 /******************************************************************************/
68
69 #ifdef WITH_EACCELERATOR_DISASSEMBLER
70
71 static const char *extopnames_declare[] = {
72         "",                                                     /* 0 */
73         "DECLARE_CLASS",                        /* 1 */
74         "DECLARE_FUNCTION",                     /* 2 */
75         "DECLARE_INHERITED_CLASS"       /* 3 */
76 };
77
78 static const char *extopnames_cast[] = {
79         "IS_NULL",                                      /* 0 */
80         "IS_LONG",                                      /* 1 */
81         "IS_DOUBLE",                            /* 2 */
82         "IS_STRING",                            /* 3 */
83         "IS_ARRAY",                                     /* 4 */
84         "IS_OBJECT",                            /* 5 */
85         "IS_BOOL",                                      /* 6 */
86         "IS_RESOURCE",                          /* 7 */
87         "IS_CONSTANT",                          /* 8 */
88         "IS_CONSTANT_ARRAY"                     /* 9 */
89 };
90
91 static const char *extopnames_fetch[] = {
92         "FETCH_STANDARD",                       /* 0 */
93         "FETCH_ADD_LOCK"                        /* 1 */
94 };
95
96 static const char *extopnames_fetch_class[] = {
97         "FETCH_CLASS_DEFAULT",          /* 0 */
98         "FETCH_CLASS_SELF",                     /* 1 */
99         "FETCH_CLASS_PARENT",           /* 2 */
100         "FETCH_CLASS_MAIN",                     /* 3 */
101         "FETCH_CLASS_GLOBAL",           /* 4 */
102         "FETCH_CLASS_AUTO"                      /* 5 */
103 };
104
105 static const char *extopnames_init_fcall[] = {
106         "&nbsp;",                                       /* 0 */
107         "MEMBER_FUNC_CALL",                     /* 1 */
108         "CTOR_CALL",                            /* 2 */
109         "CTOR_CALL"                                     /* 3 */
110 };
111
112 static const char *extopnames_sendnoref[] = {
113         "&nbsp;",                                       /* 0 */
114         "ARG_SEND_BY_REF",                      /* 1 */
115         "ARG_COMPILE_TIME_BOUND",       /* 2 */
116         "ARG_SEND_BY_REF | ZEND_ARG_COMPILE_TIME_BOUND" /* 3 */
117 };
118
119 static const char *fetchtypename[] = {
120         "FETCH_GLOBAL",                         /* 0 */
121         "FETCH_LOCAL",                          /* 1 */
122         "FETCH_STATIC"                          /* 2 */
123 #ifdef ZEND_ENGINE_2
124                 ,
125         "FETCH_STATIC_MEMBER"           /* 3 */
126 #endif
127 };
128
129 static const char *extopnames_fe[] = {
130         "",                                                     /* 0 */
131         "FE_FETCH_BYREF",                       /* 1 */
132         "FE_FETCH_WITH_KEY"                     /* 2 */
133 };
134
135 static void dump_write (const char *s, uint len)
136 {
137         uint i = 0;
138         while (i < len) {
139                 if (!s[i])
140                         ZEND_PUTS ("\\000");
141                 else if (s[i] == '\n')
142                         ZEND_PUTS ("\\n");
143                 else if (s[i] == '\r')
144                         ZEND_PUTS ("\\r");
145                 else if (s[i] < ' ')
146                         zend_printf ("\\%03o", (unsigned char) s[i]);
147                 else if (s[i] == '<')
148                         ZEND_PUTS ("&lt;");
149                 else if (s[i] == '>')
150                         ZEND_PUTS ("&gt;");
151                 else if (s[i] == '&')
152                         ZEND_PUTS ("&amp;");
153                 else if (s[i] == '\'')
154                         ZEND_PUTS ("\\'");
155                 else if (s[i] == '\\')
156                         ZEND_PUTS ("\\\\");
157                 else
158                         zend_write (&s[i], 1);
159                 ++i;
160         }
161 }
162
163 static void dump_zval (zval * v, int compress)
164 {
165         switch (v->type & ~IS_CONSTANT_INDEX) {
166         case IS_NULL:
167                 ZEND_PUTS ("null");
168                 break;
169         case IS_LONG:
170                 zend_printf ("long(%ld)", v->value.lval);
171                 break;
172         case IS_DOUBLE:
173                 zend_printf ("double(%e)", v->value.dval);
174 /*
175       zend_printf("double(%.*G)", v->value.dval);
176 */
177                 break;
178         case IS_STRING:
179                 ZEND_PUTS ("string('");
180           string_dump:
181                 dump_write (v->value.str.val, v->value.str.len);
182                 ZEND_PUTS ("')");
183                 break;
184         case IS_BOOL:
185                 zend_printf ("bool(%s)", v->value.lval ? "true" : "false");
186                 break;
187         case IS_ARRAY:
188                 ZEND_PUTS ("array(");
189           array_dump:
190                 {
191                         Bucket *p = v->value.ht->pListHead;
192                         while (p != NULL) {
193                                 if (p->nKeyLength == 0) {
194                                         zend_printf ("%lu", p->h);
195                                 } else {
196                                         int is_const = 0;
197                                         if (((zval *) p->pDataPtr)->type & IS_CONSTANT_INDEX) {
198                                                 is_const = 1;
199                                         }
200                                         if (is_const) {
201                                                 ZEND_PUTS ("constant(");
202                                         }
203                                         ZEND_PUTS (p->arKey);
204                                         if (is_const) {
205                                                 ZEND_PUTS (")");
206                                         }
207                                 }
208                                 ZEND_PUTS (" => ");
209                                 dump_zval ((zval *) p->pDataPtr, 1);
210                                 p = p->pListNext;
211                                 if (p != NULL)
212                                         ZEND_PUTS (", ");
213                         }
214                 }
215                 ZEND_PUTS (")");
216                 break;
217         case IS_OBJECT:
218 #ifdef ZEND_ENGINE_2
219                 ZEND_PUTS ("object(?)");
220 #else
221                 ZEND_PUTS ("object(");
222                 if (v->value.obj.ce != NULL) {
223                         zend_printf ("class: '%s' properties(", v->value.obj.ce);
224                 } else {
225                         ZEND_PUTS ("class: ? properties(");
226                 }
227                 if (v->value.obj.properties != NULL) {
228                         Bucket *p = v->value.obj.properties->pListHead;
229                         while (p != NULL) {
230                                 if (p->nKeyLength == 0) {
231                                         zend_printf ("%lu", p->h);
232                                 } else {
233                                         int is_const = 0;
234                                         if ((compress
235                                                  && (((zval *) p->pData)->type & IS_CONSTANT_INDEX))
236                                                 || (!compress
237                                                         && ((*(zval **) p->pData)->
238                                                                 type & IS_CONSTANT_INDEX))) {
239                                                 is_const = 1;
240                                         }
241                                         if (is_const) {
242                                                 ZEND_PUTS ("constant(");
243                                         }
244                                         ZEND_PUTS (p->arKey);
245                                         if (is_const) {
246                                                 ZEND_PUTS (")");
247                                         }
248                                 }
249                                 ZEND_PUTS (" => ");
250                                 dump_zval ((zval *) p->pDataPtr, 1);
251                                 p = p->pListNext;
252                                 if (p != NULL)
253                                         ZEND_PUTS (", ");
254                         }
255                 }
256                 ZEND_PUTS ("))");
257 #endif
258                 break;
259         case IS_RESOURCE:
260                 ZEND_PUTS ("resource(?)");
261                 break;
262         case IS_CONSTANT:
263                 ZEND_PUTS ("constant('");
264                 goto string_dump;
265         case IS_CONSTANT_ARRAY:
266                 ZEND_PUTS ("constatnt_array(");
267                 goto array_dump;
268         default:
269                 zend_printf ("unknown(%d)", v->type);
270         }
271 }
272
273 static const char *color_list[] = {
274         "#FF0000",
275         "#00FF00",
276         "#0000FF",
277         "#FFFF00",
278         "#00FFFF",
279         "#FF00FF",
280         "#800000",
281         "#008000",
282         "#000080",
283         "#808000",
284         "#008080",
285         "#800080"
286 };
287
288 static char const *color (int num)
289 {
290         return color_list[num % (sizeof (color_list) / sizeof (char *))];
291 }
292
293 static char *get_file_contents (char *filename)
294 {
295         struct stat st;
296         char *buf;
297         FILE *fp;
298
299         if (stat (filename, &st) == -1)
300                 return NULL;
301
302         buf = emalloc (st.st_size);
303         if (buf == NULL)
304                 return NULL;
305
306         fp = fopen (filename, "rb");
307         fread (buf, 1, st.st_size, fp);
308         fclose (fp);
309
310         return buf;
311 }
312
313 static void print_file_line (char *p, int line)
314 {
315         char *s;
316
317         if (p == NULL) {
318                 zend_printf ("..can't open file..");
319                 return;
320         }
321
322         while (line > 0 && *p) {
323                 if (*p == '\n') {
324                         line--;
325                 } else if (line == 1) {
326                         if (*p == '<')
327                                 zend_printf ("&lt;");
328                         else if (*p == '>')
329                                 zend_printf ("&gt;");
330                         else
331                                 zend_printf ("%c", *p);
332                 }
333
334                 p++;
335         }
336 }
337
338 static void dump_op_array (eaccelerator_op_array * p TSRMLS_DC)
339 {
340         zend_op *opline;
341         zend_op *end;
342         char *filebuf;
343         unsigned last_line = 0;
344
345 #ifdef ZEND_ENGINE_2
346         zend_printf ("T = %u, size = %u\n, brk_count = %u, file = %s<br>\n",
347                                  p->T, p->last, p->last_brk_cont, p->filename);
348 #else
349         zend_printf
350                 ("T = %u, size = %u\n, uses_globals = %d, brk_count = %u, file = %s<br>\n",
351                  p->T, p->last, p->uses_globals, p->last_brk_cont, p->filename);
352 #endif
353
354         if (p->static_variables) {
355                 Bucket *q = p->static_variables->pListHead;
356
357                 ZEND_PUTS
358                         ("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"600\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n");
359                 ZEND_PUTS
360                         ("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"200\">Static variable</th><th width=\"400\">Value</th></tr></thead>\n");
361                 ZEND_PUTS
362                         ("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all\">\n");
363
364                 while (q) {
365                         zend_printf ("<tr><td bgcolor=\"#ccccff\">$%s</td><td>", q->arKey);
366                         dump_zval ((zval *) q->pDataPtr, 1);
367                         ZEND_PUTS ("&nbsp;</td></tr>\n");
368                         q = q->pListNext;
369                 }
370                 ZEND_PUTS ("<tbody></table><br>\n");
371         }
372
373         if (p->opcodes) {
374                 int n = 0;
375                 opline = p->opcodes;
376                 end = opline + p->last;
377
378                 filebuf = get_file_contents (p->filename);
379
380                 ZEND_PUTS
381                         ("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"900\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n");
382                 ZEND_PUTS
383                         ("<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");
384                 ZEND_PUTS
385                         ("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all; font-size: x-small\">\n");
386                 for (; opline < end; opline++) {
387                         const opcode_dsc *op = get_opcode_dsc (opline->opcode);
388
389                         while (last_line < opline->lineno) {
390                                 last_line++;
391                                 zend_printf
392                                         ("<tr><td colspan=6 bgcolor=black><pre><font color=#80ff80>");
393                                 print_file_line (filebuf, last_line);
394                                 zend_printf ("</font></pre></td></tr>\n");
395                         }
396
397                         if (op != NULL) {
398                                 zend_printf
399                                         ("<tr><td><font color=%s>%d</font> </td><td>%s </td>",
400                                          color (n), n, op->opname);
401                                 if ((op->ops & EXT_MASK) == EXT_OPLINE) {
402                                         zend_printf
403                                                 ("<td><font color=%s>opline(%lu)</font> </td>",
404                                                  color (opline->
405                                                                 extended_value), opline->extended_value);
406                                 } else if ((op->ops & EXT_MASK) == EXT_FCALL) {
407                                         zend_printf ("<td>args(%lu) </td>", opline->extended_value);
408                                 } else if ((op->ops & EXT_MASK) == EXT_ARG) {
409                                         zend_printf ("<td>arg(%lu) </td>", opline->extended_value);
410                                 } else if ((op->ops & EXT_MASK) == EXT_SEND) {
411                                         zend_printf ("<td>%s </td>",
412                                                                  get_opcode_dsc (opline->
413                                                                                                  extended_value)->opname);
414                                 } else if ((op->ops & EXT_MASK) == EXT_CAST) {
415                                         zend_printf ("<td>%s </td>",
416                                                                  extopnames_cast[opline->extended_value]);
417                                 } else if ((op->ops & EXT_MASK) == EXT_INIT_FCALL) {
418                                         zend_printf ("<td>%s </td>",
419                                                                  extopnames_init_fcall[opline->extended_value]);
420                                 } else if ((op->ops & EXT_MASK) == EXT_FETCH) {
421                                         zend_printf ("<td>%s </td>",
422                                                                  extopnames_fetch[opline->extended_value]);
423                                 } else if ((op->ops & EXT_MASK) == EXT_FE) {
424                                         zend_printf ("<td>%s </td>",
425                                                                  extopnames_fe[opline->extended_value]);
426                                 } else if ((op->ops & EXT_MASK) == EXT_DECLARE) {
427                                         zend_printf ("<td>%s </td>",
428                                                                  extopnames_declare[opline->extended_value]);
429                                 } else if ((op->ops & EXT_MASK) == EXT_SEND_NOREF) {
430                                         zend_printf ("<td>%s </td>",
431                                                                  extopnames_sendnoref[opline->extended_value]);
432                                 } else if ((op->ops & EXT_MASK) == EXT_FCLASS) {
433                                         zend_printf ("<td>%s </td>",
434                                                                  extopnames_fetch_class
435                                                                  [opline->extended_value]);
436                                 } else if ((op->ops & EXT_MASK) == EXT_IFACE) {
437                                         zend_printf
438                                                 ("<td>interface(%lu) </td>", opline->extended_value);
439                                 } else if ((op->ops & EXT_MASK) == EXT_CLASS) {
440                                         zend_printf ("<td>$class%u </td>",
441                                                                  VAR_NUM (opline->extended_value));
442                                 } else if ((op->ops & EXT_MASK) == EXT_BIT) {
443                                         zend_printf ("<td>%s </td>",
444                                                                  opline->extended_value ? "true" : "false");
445                                 } else if ((op->ops & EXT_MASK) == EXT_ISSET) {
446                                         if (opline->extended_value == ZEND_ISSET) {
447                                                 ZEND_PUTS ("<td>ZEND_ISSET </td>");
448                                         } else if (opline->extended_value == ZEND_ISEMPTY) {
449                                                 ZEND_PUTS ("<td>ZEND_ISEMPTY </td>");
450                                         } else {
451                                                 ZEND_PUTS ("<td>&nbsp; </td>");
452                                         }
453 #ifdef ZEND_ENGINE_2
454                                 } else if ((op->ops & EXT_MASK) == EXT_ASSIGN) {
455                                         if (opline->extended_value == ZEND_ASSIGN_OBJ) {
456                                                 ZEND_PUTS ("<td>ZEND_ASSIGN_OBJ </td>");
457                                         } else if (opline->extended_value == ZEND_ASSIGN_DIM) {
458                                                 ZEND_PUTS ("<td>ZEND_ASSIGN_DIM </td>");
459                                         } else {
460                                                 ZEND_PUTS ("<td>&nbsp; </td>");
461                                         }
462                                 } else if (opline->opcode == ZEND_UNSET_DIM_OBJ) {
463                                         if (opline->extended_value == ZEND_UNSET_DIM) {
464                                                 ZEND_PUTS ("<td>ZEND_UNSET_DIM </td>");
465                                         } else if (opline->extended_value == ZEND_UNSET_OBJ) {
466                                                 ZEND_PUTS ("<td>ZEND_UNSET_OBJ </td>");
467                                         } else {
468                                                 ZEND_PUTS ("<td>&nbsp; </td>");
469                                         }
470 #endif
471                                 } else if (opline->extended_value != 0) {
472                                         zend_printf ("<td>%ld </td>", opline->extended_value);
473                                 } else {
474                                         ZEND_PUTS ("<td>&nbsp;</td>");
475                                 }
476                         } else {
477                                 zend_printf
478                                         ("<tr><td>%d </td><td>UNKNOWN_OPCODE %d </td><td>%lu </td>",
479                                          n, opline->opcode, opline->extended_value);
480                                 op = get_opcode_dsc (0);
481                         }
482
483                         if ((op->ops & OP1_MASK) == OP1_OPLINE) {
484                                 zend_printf
485                                         ("<td><font color=%s>opline(%d)</font> </td>",
486                                          color (opline->op1.u.opline_num),
487                                          opline->op1.u.opline_num);
488 #ifdef ZEND_ENGINE_2
489                         } else if ((op->ops & OP1_MASK) == OP1_JMPADDR) {
490                                 zend_printf
491                                         ("<td><font color=%s>opline(%u)</font> </td>",
492                                          color ((unsigned int) (opline->op1.u.
493                                                                                         jmp_addr -
494                                                                                         p->opcodes)),
495                                          (unsigned int) (opline->op1.u.jmp_addr - p->opcodes));
496                         } else if ((op->ops & OP1_MASK) == OP1_CLASS) {
497                                 zend_printf ("<td>$class%u </td>", VAR_NUM (opline->op1.u.var));
498                         } else if ((op->ops & OP1_MASK) == OP1_UCLASS) {
499                                 if (opline->op1.op_type == IS_UNUSED) {
500                                         zend_printf ("<td>&nbsp; </td>");
501                                 } else {
502                                         zend_printf ("<td>$class%u </td>",
503                                                                  VAR_NUM (opline->op1.u.var));
504                                 }
505 #endif
506                         } else if ((op->ops & OP1_MASK) == OP1_BRK) {
507                                 if (opline->op1.u.opline_num != -1 &&
508                                         opline->op2.op_type == IS_CONST &&
509                                         opline->op2.u.constant.type == IS_LONG) {
510                                         int level = opline->op2.u.constant.value.lval;
511                                         zend_uint offset = opline->op1.u.opline_num;
512                                         zend_brk_cont_element *jmp_to;
513                                         do {
514                                                 if (offset >= p->last_brk_cont) {
515                                                         goto brk_failed;
516                                                 }
517                                                 jmp_to = &p->brk_cont_array[offset];
518                                                 offset = jmp_to->parent;
519                                         }
520                                         while (--level > 0);
521                                         zend_printf
522                                                 ("<td><font color=%s>opline(%d)</font> </td>",
523                                                  color (jmp_to->brk), jmp_to->brk);
524                                 } else {
525                                   brk_failed:
526                                         zend_printf ("<td>brk_cont(%u) </td>",
527                                                                  opline->op1.u.opline_num);
528                                 }
529                         } else if ((op->ops & OP1_MASK) == OP1_CONT) {
530                                 if (opline->op1.u.opline_num != -1 &&
531                                         opline->op2.op_type == IS_CONST &&
532                                         opline->op2.u.constant.type == IS_LONG) {
533                                         int level = opline->op2.u.constant.value.lval;
534                                         zend_uint offset = opline->op1.u.opline_num;
535                                         zend_brk_cont_element *jmp_to;
536                                         do {
537                                                 if (offset >= p->last_brk_cont) {
538                                                         goto cont_failed;
539                                                 }
540                                                 jmp_to = &p->brk_cont_array[offset];
541                                                 offset = jmp_to->parent;
542                                         }
543                                         while (--level > 0);
544                                         zend_printf
545                                                 ("<td><font color=%s>opline(%d)</font> </td>",
546                                                  color (jmp_to->cont), jmp_to->cont);
547                                 } else {
548                                   cont_failed:
549                                         zend_printf ("<td>brk_cont(%u) </td>",
550                                                                  opline->op1.u.opline_num);
551                                 }
552                         } else if ((op->ops & OP1_MASK) == OP1_ARG) {
553                                 zend_printf ("<td>arg(%ld) </td>",
554                                                          opline->op1.u.constant.value.lval);
555                         } else if ((op->ops & OP1_MASK) == OP1_VAR) {
556                                 zend_printf
557                                         ("<td><font color=%s>$var%u</font> </td>",
558                                          color (VAR_NUM (opline->op1.u.var)),
559                                          VAR_NUM (opline->op1.u.var));
560                         } else if ((op->ops & OP1_MASK) == OP1_TMP) {
561                                 zend_printf
562                                         ("<td><font color=%s>$tmp%u</font> </td>",
563                                          color (VAR_NUM (opline->op1.u.var)),
564                                          VAR_NUM (opline->op1.u.var));
565                         } else {
566                                 if (opline->op1.op_type == IS_CONST) {
567                                         ZEND_PUTS ("<td>");
568                                         dump_zval (&opline->op1.u.constant, 0);
569                                         ZEND_PUTS (" </td>");
570                                 } else if (opline->op1.op_type == IS_TMP_VAR) {
571                                         zend_printf
572                                                 ("<td><font color=%s>$tmp%u</font> </td>",
573                                                  color (VAR_NUM
574                                                                 (opline->op1.u.var)),
575                                                  VAR_NUM (opline->op1.u.var));
576                                 } else if (opline->op1.op_type == IS_VAR) {
577                                         zend_printf
578                                                 ("<td><font color=%s>$var%u</font> </td>",
579                                                  color (VAR_NUM
580                                                                 (opline->op1.u.var)),
581                                                  VAR_NUM (opline->op1.u.var));
582                                 } else if (opline->op1.op_type == IS_UNUSED) {
583                                         ZEND_PUTS ("<td>&nbsp;</td>");
584                                 } else {
585                                         zend_printf
586                                                 ("<td>UNKNOWN NODE %d </td>", opline->op1.op_type);
587                                 }
588                         }
589
590                         if ((op->ops & OP2_MASK) == OP2_OPLINE) {
591                                 zend_printf
592                                         ("<td><font color=%s>opline(%d)</font> </td>",
593                                          color (opline->op2.u.opline_num),
594                                          opline->op2.u.opline_num);
595 #ifdef ZEND_ENGINE_2
596                         } else if ((op->ops & OP2_MASK) == OP2_JMPADDR) {
597                                 zend_printf
598                                         ("<td><font color=%s>opline(%u)</font> </td>",
599                                          color ((unsigned int) (opline->op2.u.
600                                                                                         jmp_addr -
601                                                                                         p->opcodes)),
602                                          (unsigned int) (opline->op2.u.jmp_addr - p->opcodes));
603                         } else if ((op->ops & OP2_MASK) == OP2_CLASS) {
604                                 zend_printf ("<td>$class%u </td>", VAR_NUM (opline->op2.u.var));
605 #endif
606                         } else if ((op->ops & OP2_MASK) == OP2_VAR) {
607                                 zend_printf
608                                         ("<td><font color=%s>$var%u</font> </td>",
609                                          color (VAR_NUM (opline->op2.u.var)),
610                                          VAR_NUM (opline->op2.u.var));
611                         } else if ((op->ops & OP2_MASK) == OP2_FETCH) {
612 #ifdef ZEND_ENGINE_2
613                                 if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
614                                         zend_printf ("<td>%s $class%u</td>",
615                                                                  fetchtypename[opline->
616                                                                                            op2.u.EA.
617                                                                                            type],
618                                                                  VAR_NUM (opline->op2.u.var));
619                                 } else {
620                                         zend_printf ("<td>%s </td>",
621                                                                  fetchtypename[opline->op2.u.EA.type]);
622                                 }
623 #else
624                                 zend_printf ("<td>%s </td>",
625                                                          fetchtypename[opline->op2.u.fetch_type]);
626 #endif
627                         } else if ((op->ops & OP2_MASK) == OP2_INCLUDE) {
628                                 if (opline->op2.u.constant.value.lval == ZEND_EVAL) {
629                                         ZEND_PUTS ("<td>ZEND_EVAL </td>");
630                                 } else if (opline->op2.u.constant.value.lval == ZEND_INCLUDE) {
631                                         ZEND_PUTS ("<td>ZEND_INCLUDE </td>");
632                                 } else if (opline->op2.u.constant.value.lval ==
633                                                    ZEND_INCLUDE_ONCE) {
634                                         ZEND_PUTS ("<td>ZEND_INCLUDE_ONCE </td>");
635                                 } else if (opline->op2.u.constant.value.lval == ZEND_REQUIRE) {
636                                         ZEND_PUTS ("<td>ZEND_REQUIRE </td>");
637                                 } else if (opline->op2.u.constant.value.lval ==
638                                                    ZEND_REQUIRE_ONCE) {
639                                         ZEND_PUTS ("<td>ZEND_REQUIRE_ONCE </td>");
640                                 } else {
641                                         ZEND_PUTS ("<td>&nbsp;</td>");
642                                 }
643                         } else if ((op->ops & OP2_MASK) == OP2_ARG) {
644                                 zend_printf ("<td>arg(%u) </td>", opline->op2.u.opline_num);
645                         } else if ((op->ops & OP2_MASK) == OP2_ISSET) {
646                                 if (opline->op2.u.constant.value.lval == ZEND_ISSET) {
647                                         ZEND_PUTS ("<td>ZEND_ISSET </td>");
648                                 } else if (opline->op2.u.constant.value.lval == ZEND_ISEMPTY) {
649                                         ZEND_PUTS ("<td>ZEND_ISEMPTY </td>");
650                                 } else {
651                                         ZEND_PUTS ("<td>&nbsp; </td>");
652                                 }
653                         } else {
654                                 if (opline->op2.op_type == IS_CONST) {
655                                         ZEND_PUTS ("<td>");
656                                         dump_zval (&opline->op2.u.constant, 0);
657                                         ZEND_PUTS (" </td>");
658                                 } else if (opline->op2.op_type == IS_TMP_VAR) {
659                                         zend_printf
660                                                 ("<td><font color=%s>$tmp%u</font> </td>",
661                                                  color (VAR_NUM
662                                                                 (opline->op2.u.var)),
663                                                  VAR_NUM (opline->op2.u.var));
664                                 } else if (opline->op2.op_type == IS_VAR) {
665                                         zend_printf
666                                                 ("<td><font color=%s>$var%u</font> </td>",
667                                                  color (VAR_NUM
668                                                                 (opline->op2.u.var)),
669                                                  VAR_NUM (opline->op2.u.var));
670                                 } else if (opline->op2.op_type == IS_UNUSED) {
671                                         ZEND_PUTS ("<td>&nbsp; </td>");
672                                 } else {
673                                         zend_printf
674                                                 ("<td>UNKNOWN NODE %d </td>", opline->op2.op_type);
675                                 }
676                         }
677
678                         switch (op->ops & RES_MASK) {
679                         case RES_STD:
680                                 if (opline->result.op_type == IS_CONST) {
681                                         ZEND_PUTS ("<td>");
682                                         dump_zval (&opline->result.u.constant, 0);
683                                         ZEND_PUTS ("</td>");
684                                 } else if (opline->result.op_type == IS_TMP_VAR) {
685                                         zend_printf
686                                                 ("<td><font color=%s>$tmp%u</font> </td>",
687                                                  color (VAR_NUM
688                                                           &n