Changeset 781
- Timestamp:
- 2011-04-22T14:05:08+02:00 (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
Decompiler.class.php (modified) (5 diffs)
-
decompilesample.php (modified) (1 diff)
-
xcache.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Decompiler.class.php
r780 r781 1141 1141 break; 1142 1142 } 1143 if (is_a($rvalue, 'Decompiler_Fetch')) { 1144 $src = str($rvalue->src, $EX); 1145 if ('$' . unquoteName($src) == $lvalue) { 1146 switch ($rvalue->fetchType) { 1147 case ZEND_FETCH_STATIC: 1148 $statics = &$EX['op_array']['static_variables']; 1149 if ((xcache_get_type($statics[$name]) & IS_LEXICAL_VAR)) { 1150 $EX['uses'][] = str($lvalue); 1151 unset($statics); 1152 break 2; 1153 } 1154 unset($statics); 1155 } 1156 } 1157 } 1143 1158 $resvar = "$lvalue = " . str($rvalue, $EX); 1144 if (0) {1145 if ($op2['op_type'] == XC_IS_VAR) {1146 $resvar .= ' /* isvar */';1147 }1148 else if ($op2['op_type'] == XC_IS_TMP_VAR) {1149 $resvar .= ' /* istmp */';1150 }1151 }1152 1159 break; 1153 1160 // }}} … … 1165 1172 case ZEND_FETCH_STATIC: 1166 1173 $statics = &$EX['op_array']['static_variables']; 1174 if ((xcache_get_type($statics[$name]) & IS_LEXICAL_REF)) { 1175 $EX['uses'][] = '&' . str($lvalue); 1176 unset($statics); 1177 break 2; 1178 } 1179 1167 1180 $resvar = 'static ' . $lvalue; 1168 1181 $name = unquoteName($src); … … 1854 1867 function duses(&$EX, $indent) // {{{ 1855 1868 { 1856 if (!$EX['uses']) { 1857 return; 1858 } 1859 1860 $uses = array(); 1861 foreach ($EX['uses'] as $name => $value) { 1862 $uses = '$' . $name; 1863 } 1864 echo ' use(', implode(', ', $uses), ')'; 1869 if ($EX['uses']) { 1870 echo ' use(', implode(', ', $EX['uses']), ')'; 1871 } 1865 1872 } 1866 1873 // }}} … … 1886 1893 $functionName = ''; 1887 1894 } 1888 echo 'function ', $functionName, '(';1895 echo 'function', $functionName ? ' ' . $functionName : '', '('; 1889 1896 $this->dargs($EX, $indent); 1890 1897 echo ")"; … … 2257 2264 define('IS_CONSTANT', 8); 2258 2265 define('IS_CONSTANT_ARRAY', 9); 2266 /* Ugly hack to support constants as static array indices */ 2267 define('IS_CONSTANT_TYPE_MASK', 0x0f); 2268 define('IS_CONSTANT_UNQUALIFIED', 0x10); 2269 define('IS_CONSTANT_INDEX', 0x80); 2270 define('IS_LEXICAL_VAR', 0x20); 2271 define('IS_LEXICAL_REF', 0x40); 2259 2272 2260 2273 @define('XC_IS_CV', 16); -
trunk/decompilesample.php
r780 r781 360 360 $total = 0; 361 361 $tax = 1; 362 $callback = function ($quantity, $product) use ($tax, &$total) { 363 static $static = array(1); 362 $callback = function($quantity, $product) use($tax, &$total) { 363 $tax = 'tax'; 364 static $static1 = array(1); 365 static $static2; 364 366 $tax = 'tax'; 365 367 $tax = --$tax; -
trunk/xcache.c
r780 r781 2876 2876 /* }}} */ 2877 2877 /* {{{ proto int xcache_get_refcount(mixed variable) 2878 Get reference count of variable */2878 XCache internal uses only: Get reference count of variable */ 2879 2879 PHP_FUNCTION(xcache_get_refcount) 2880 2880 { … … 2888 2888 /* }}} */ 2889 2889 /* {{{ proto bool xcache_get_isref(mixed variable) 2890 check if variable data is marked referenced */ 2890 XCache internal uses only: Check if variable data is marked referenced */ 2891 ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_isref, 0, 0, 1) 2892 ZEND_ARG_INFO(1, variable) 2893 ZEND_END_ARG_INFO() 2894 2891 2895 PHP_FUNCTION(xcache_get_isref) 2892 2896 { … … 2896 2900 } 2897 2901 2898 RETURN_BOOL(Z_ISREF_P(variable) );2902 RETURN_BOOL(Z_ISREF_P(variable) && Z_REFCOUNT_P(variable) >= 3); 2899 2903 } 2900 2904 /* }}} */ … … 3047 3051 /* }}} */ 3048 3052 #endif 3049 /* {{{ proto mixed xcache_get_special_value(zval value) */ 3053 /* {{{ proto mixed xcache_get_special_value(zval value) 3054 XCache internal use only: For decompiler to get static value with type fixed */ 3050 3055 PHP_FUNCTION(xcache_get_special_value) 3051 3056 { … … 3072 3077 RETURN_NULL(); 3073 3078 } 3079 } 3080 /* }}} */ 3081 /* {{{ proto int xcache_get_type(zval value) 3082 XCache internal use only for disassembler to get variable type in engine level */ 3083 PHP_FUNCTION(xcache_get_type) 3084 { 3085 zval *value; 3086 3087 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) { 3088 return; 3089 } 3090 3091 RETURN_LONG(Z_TYPE_P(value)); 3074 3092 } 3075 3093 /* }}} */ … … 3126 3144 #endif 3127 3145 PHP_FE(xcache_get_special_value, NULL) 3146 PHP_FE(xcache_get_type, NULL) 3128 3147 PHP_FE(xcache_get_op_type, NULL) 3129 3148 PHP_FE(xcache_get_data_type, NULL) … … 3141 3160 PHP_FE(xcache_unset_by_prefix, NULL) 3142 3161 PHP_FE(xcache_get_refcount, NULL) 3143 PHP_FE(xcache_get_isref, NULL)3162 PHP_FE(xcache_get_isref, arginfo_xcache_get_isref) 3144 3163 #ifdef HAVE_XCACHE_DPRINT 3145 3164 PHP_FE(xcache_dprint, NULL)
Note: See TracChangeset
for help on using the changeset viewer.

