From db3cc8b69b1da39c7620edd90d1f8cf2e992a69c Mon Sep 17 00:00:00 2001 From: Xuefer Date: Fri, 12 Jul 2013 07:58:09 +0000 Subject: [PATCH] disassembler, Decompiler: fix ISSET_ISEMPTY_VAR git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1300 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- lib/Decompiler.class.php | 25 ++++++++++--------------- xcache/xc_opcode_spec_def.h | 4 ++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/Decompiler.class.php b/lib/Decompiler.class.php index 172cbaf..42c9b97 100644 --- a/lib/Decompiler.class.php +++ b/lib/Decompiler.class.php @@ -1473,23 +1473,17 @@ class Decompiler case XC_FETCH_IS: case XC_UNSET_VAR: $rvalue = $this->getOpVal($op1, $EX); - if (defined('ZEND_FETCH_TYPE_MASK')) { - $fetchtype = ($ext & ZEND_FETCH_TYPE_MASK); - } - else { - $fetchtype = $op2['EA.type']; - } - switch ($fetchtype) { - case ZEND_FETCH_STATIC_MEMBER: + $fetchtype = defined('ZEND_FETCH_TYPE_MASK') ? ($ext & ZEND_FETCH_TYPE_MASK) : $op2['EA.type']; + if ($fetchtype == ZEND_FETCH_STATIC_MEMBER) { $class = $this->getOpVal($op2, $EX); - $rvalue = str($class) . '::$' . unquoteName($rvalue, $EX); - break; - default: + $rvalue = unquoteName(str($class)) . '::$' . unquoteName($rvalue, $EX); + } + else if ($opc != XC_UNSET_VAR) { $name = unquoteName($rvalue, $EX); $globalname = xcache_is_autoglobal($name) ? "\$$name" : "\$GLOBALS[" . str($rvalue) . "]"; $rvalue = new Decompiler_Fetch($rvalue, $fetchtype, $globalname); - break; } + if ($opc == XC_UNSET_VAR) { $op['php'] = "unset(" . str($rvalue, $EX) . ")"; $lastphpop = &$op; @@ -1677,9 +1671,10 @@ class Decompiler if ($op1['op_type'] == XC_IS_CONST) { $rvalue = '$' . unquoteVariableName($this->getOpVal($op1, $EX)); } - if (!ZEND_ENGINE_2_4 && $op2['EA.type'] == ZEND_FETCH_STATIC_MEMBER) { + $fetchtype = defined('ZEND_FETCH_TYPE_MASK') ? ($ext & ZEND_FETCH_TYPE_MASK) : $op2['EA.type']; + if ($fetchtype == ZEND_FETCH_STATIC_MEMBER) { $class = $this->getOpVal($op2, $EX); - $rvalue = $class . '::' . $rvalue; + $rvalue = unquoteName(str($class)) . '::' . unquoteName($rvalue, $EX); } } else if ($opc == XC_ISSET_ISEMPTY) { @@ -2025,7 +2020,7 @@ class Decompiler break; case XC_RECV_INIT: case XC_RECV: - $offset = $op1['var']; + $offset = isset($op1['var']) ? $op1['var'] : $op1['constant']; $lvalue = $this->getOpVal($op['result'], $EX); if ($opc == XC_RECV_INIT) { $default = value($op['op2']['constant']); diff --git a/xcache/xc_opcode_spec_def.h b/xcache/xc_opcode_spec_def.h index 2e1b955..bc4596e 100644 --- a/xcache/xc_opcode_spec_def.h +++ b/xcache/xc_opcode_spec_def.h @@ -149,7 +149,11 @@ static const xc_opcode_spec_t xc_opcode_spec[] = { #else OPSPEC( UNUSED, UCLASS, STD, UNUSED) /* 113 INIT_STATIC_METHOD_CALL */ #endif +#ifdef ZEND_ENGINE_2_4 + OPSPEC( ISSET, STD, STD, TMP) /* 114 ISSET_ISEMPTY_VAR */ +#else OPSPEC( ISSET, STD, FETCH, TMP) /* 114 ISSET_ISEMPTY_VAR */ +#endif OPSPEC( ISSET, STD, STD, TMP) /* 115 ISSET_ISEMPTY_DIM_OBJ */ OPSPEC( UNUSED, CLASS, STD, UNUSED) /* 116 IMPORT_FUNCTION */