Changeset 1582 in svn
- Timestamp:
- 2015-04-18T07:26:12Z (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Decompiler.class.php
r1530 r1582 27 27 } 28 28 } 29 $args[] = 'array('. implode(', ', $array) . ')';29 $args[] = "array(" . implode(', ', $array) . ')'; 30 30 } 31 31 else { … … 439 439 } 440 440 $max = call_user_func_array('max', $keys); 441 $list = 'list(';442 for ($i = 0; $i <= $max; $i 441 $list = "list("; 442 for ($i = 0; $i <= $max; $i++) { 443 443 if ($i) { 444 444 $list .= ', '; … … 506 506 } 507 507 if (is_array($value) || is_a($value, 'Decompiler_Array')) { 508 $multiline 508 $multiline++; 509 509 } 510 510 } … … 537 537 $exp .= $value; 538 538 539 $i 539 $i++; 540 540 } 541 541 if ($multiline) { … … 602 602 if ($this->test) { 603 603 $content = file_get_contents(__FILE__); 604 for ($i = 0; $opname = xcache_get_opcode($i); $i 604 for ($i = 0; $opname = xcache_get_opcode($i); $i++) { 605 605 if (!preg_match("/\\bXC_" . $opname . "\\b(?!')/", $content)) { 606 606 echo "not recognized opcode ", $opname, "\n"; … … 700 700 $indent = $EX['indent']; 701 701 $curticks = 0; 702 for ($i = $range[0]; $i <= $range[1]; $i 702 for ($i = $range[0]; $i <= $range[1]; $i++) { 703 703 $op = $EX['opcodes'][$i]; 704 704 if (isset($op['gofrom'])) { … … 786 786 } 787 787 // }}} 788 function fixOpCode( &$opcodes, $removeTailing = false, $defaultReturnValue = null) // {{{788 function fixOpCode($opcodes, $removeTailing = false, $defaultReturnValue = null) // {{{ 789 789 { 790 790 $last = count($opcodes) - 1; 791 for ($i = 0; $i <= $last; $i 791 for ($i = 0; $i <= $last; $i++) { 792 792 if (function_exists('xcache_get_fixed_opcode')) { 793 793 $opcodes[$i]['opcode'] = xcache_get_fixed_opcode($opcodes[$i]['opcode'], $i); … … 837 837 } 838 838 } 839 return $opcodes; 839 840 } 840 841 // }}} … … 1112 1113 $this->dasmBasicBlock($EX, array($catchFirst, $catchOpLine)); 1113 1114 $catchOp = &$opcodes[$catchOpLine]; 1114 echo $indent, 'catch ('1115 echo $indent, "catch (" 1115 1116 , $this->stripNamespace(isset($catchOp['op1']['constant']) ? $catchOp['op1']['constant'] : str($this->getOpVal($catchOp['op1'], $EX))) 1116 1117 , ' ' … … 1277 1278 $body = ob_get_clean(); 1278 1279 1279 echo $indent, 'while (', str($this->getOpVal($firstJmpOp['op1'], $EX)), ") {", PHP_EOL;1280 echo $indent, "while (", str($this->getOpVal($firstJmpOp['op1'], $EX)), ") {", PHP_EOL; 1280 1281 echo $body; 1281 1282 echo $indent, '}', PHP_EOL; … … 1307 1308 } 1308 1309 1309 echo $indent, 'foreach (', str($firstJmpOp['fe_src'], $EX), " as $as) {", PHP_EOL;1310 echo $indent, "foreach (", str($firstJmpOp['fe_src'], $EX), " as $as) {", PHP_EOL; 1310 1311 echo $body; 1311 1312 echo $indent, '}', PHP_EOL; … … 1379 1380 $opcodes = &$op_array['opcodes']; 1380 1381 $last = count($opcodes) - 1; 1381 for ($i = 0; $i <= $last; $i 1382 for ($i = 0; $i <= $last; $i++) { 1382 1383 $op = &$opcodes[$i]; 1383 1384 $op['line'] = $i; … … 1479 1480 function &dop_array($op_array, $indent = '') // {{{ 1480 1481 { 1481 $ this->fixOpCode($op_array['opcodes'], true, $indent == '' ? 1 : null);1482 $op_array['opcodes'] = $this->fixOpCode($op_array['opcodes'], true, $indent == '' ? 1 : null); 1482 1483 $this->buildJmpInfo($op_array); 1483 1484 … … 1487 1488 $nextbbs = array(); 1488 1489 $starti = 0; 1489 for ($i = 1; $i <= $last; $i 1490 for ($i = 1; $i <= $last; $i++) { 1490 1491 if (isset($opcodes[$i]['jmpins']) 1491 1492 || isset($opcodes[$i - 1]['jmpouts'])) { … … 1550 1551 $currentSourceLine = null; 1551 1552 1552 for ($i = $range[0]; $i <= $range[1]; $i 1553 for ($i = $range[0]; $i <= $range[1]; $i++, unsetArray($EX['value2constant'], $currentSourceLine)) { 1553 1554 // {{{ prepair 1554 1555 $op = &$opcodes[$i]; … … 1569 1570 1570 1571 if ($opname == 'UNDEF' || !isset($opname)) { 1571 echo ' UNDEF OP:';1572 echo '// UNDEF OP:'; 1572 1573 $this->dumpop($op, $EX); 1573 1574 continue; … … 1823 1824 case ZEND_FETCH_STATIC: 1824 1825 $statics = &$EX['op_array']['static_variables']; 1826 $name = unquoteName($src); 1825 1827 if ((xcache_get_type($statics[$name]) & IS_LEXICAL_REF)) { 1826 1828 $EX['uses'][] = '&' . str($lvalue); … … 1830 1832 1831 1833 $resvar = 'static ' . $lvalue; 1832 $name = unquoteName($src);1833 1834 if (isset($statics[$name])) { 1834 1835 $var = $statics[$name]; … … 2015 2016 break; 2016 2017 // }}} 2017 case XC_DECLARE_CLASS: 2018 case XC_DECLARE_CLASS: 2018 2019 case XC_DECLARE_INHERITED_CLASS: 2019 2020 case XC_DECLARE_INHERITED_CLASS_DELAYED: // {{{ 2020 2021 $key = $op1['constant']; 2021 2022 if (!isset($this->dc['class_table'][$key])) { 2022 echo 'class not found: ', $key, 'existing classes are:', "\n";2023 echo "class not found: ", $key, "\nexisting classes are:\n"; 2023 2024 var_dump(array_keys($this->dc['class_table'])); 2024 2025 exit; … … 2287 2288 2288 2289 case XC_BEGIN_SILENCE: // {{{ 2289 $EX['silence'] 2290 $EX['silence']++; 2290 2291 break; 2291 2292 // }}} 2292 2293 case XC_END_SILENCE: // {{{ 2293 $EX['silence'] 2294 $EX['silence']--; 2294 2295 $lastresvar = '@' . str($lastresvar, $EX); 2295 2296 break; … … 2409 2410 { 2410 2411 $args = array(); 2411 for ($i = 0; $i < $n; $i 2412 for ($i = 0; $i < $n; $i++) { 2412 2413 $a = array_pop($EX['argstack']); 2413 2414 if (is_array($a)) { … … 2473 2474 { 2474 2475 for ($i = $range[0]; $i <= $range[1]; ++$i) { 2475 echo $EX['indent'], $i, "\t"; $this->dumpop($EX['opcodes'][$i], $EX); 2476 echo $EX['indent'], $i, "\t"; 2477 $this->dumpop($EX['opcodes'][$i], $EX); 2476 2478 } 2477 2479 echo $EX['indent'], "==", PHP_EOL; … … 2494 2496 2495 2497 $refrest = false; 2496 for ($i = 0; $i < $c; $i 2498 for ($i = 0; $i < $c; $i++) { 2497 2499 if ($i) { 2498 2500 echo ', '; … … 2549 2551 { 2550 2552 if ($EX['uses']) { 2551 echo ' use(', implode(', ', $EX['uses']), ')';2553 echo " use(", implode(', ', $EX['uses']), ')'; 2552 2554 } 2553 2555 } … … 2759 2761 2760 2762 switch ($opa['fn_flags'] & ZEND_ACC_PPP_MASK) { 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2763 case ZEND_ACC_PUBLIC: 2764 $decorations[] = "public"; 2765 break; 2766 case ZEND_ACC_PRIVATE: 2767 $decorations[] = "private"; 2768 break; 2769 case ZEND_ACC_PROTECTED: 2770 $decorations[] = "protected"; 2771 break; 2772 default: 2773 $decorations[] = "<visibility error>"; 2774 break; 2773 2775 } 2774 2776 } … … 2854 2856 function outputUnusedOp() // {{{ 2855 2857 { 2856 for ($i = 0; $opname = xcache_get_opcode($i); $i 2857 if ($opname == 'UNDEF') 2858 for ($i = 0; $opname = xcache_get_opcode($i); $i++) { 2859 if ($opname == 'UNDEF') { 2858 2860 continue; 2859 2861 } … … 3040 3042 } 3041 3043 //*/ 3042 foreach (array 3044 foreach (array( 3043 3045 'XC_ADD_INTERFACE' => -1, 3044 3046 'XC_ASSIGN_DIM' => -1,
Note: See TracChangeset
for help on using the changeset viewer.