Changeset 784
- Timestamp:
- 2011-04-22T17:18:42+02:00 (2 years ago)
- Location:
- branches/1.3
- Files:
-
- 9 edited
-
. (modified) (1 prop)
-
ChangeLog (modified) (1 diff)
-
Decompiler.class.php (modified) (10 diffs)
-
NEWS (modified) (1 diff)
-
admin/common.php (modified) (5 diffs)
-
decompilesample.php (modified) (1 diff)
-
opcode_spec_def.h (modified) (1 diff)
-
utils.c (modified) (1 diff)
-
xcache.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
- Property svn:mergeinfo changed
/trunk merged: 775-778,780-783
- Property svn:mergeinfo changed
-
branches/1.3/ChangeLog
r766 r784 1 1 1.3.2 2011-??-?? 2 2 ======== 3 * avoid possible filename injection in admin page 3 4 * adds 30 seconds timeout to "compiling" flag 4 5 * decompiler: improves decompiling -
branches/1.3/Decompiler.class.php
r766 r784 737 737 $EX['last'] = count($opcodes) - 1; 738 738 $EX['silence'] = 0; 739 $EX['recvs'] = array(); 740 $EX['uses'] = array(); 739 741 740 742 for ($next = 0, $last = $EX['last']; … … 1139 1141 break; 1140 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 } 1141 1158 $resvar = "$lvalue = " . str($rvalue, $EX); 1142 1159 break; … … 1155 1172 case ZEND_FETCH_STATIC: 1156 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 1157 1180 $resvar = 'static ' . $lvalue; 1158 1181 $name = unquoteName($src); … … 1203 1226 if ($opc == XC_ISSET_ISEMPTY_VAR) { 1204 1227 $rvalue = $this->getOpVal($op1, $EX); 1228 // for < PHP_5_3 1229 if ($op1['op_type'] == XC_IS_CONST) { 1230 $rvalue = '$' . unquoteVariableName($this->getOpVal($op1, $EX)); 1231 } 1205 1232 if ($op2['EA.type'] == ZEND_FETCH_STATIC_MEMBER) { 1206 1233 $class = $this->getOpVal($op2, $EX); … … 1227 1254 switch ((!ZEND_ENGINE_2 ? $op['op2']['var'] /* constant */ : $ext) & (ZEND_ISSET|ZEND_ISEMPTY)) { 1228 1255 case ZEND_ISSET: 1229 $rvalue = "isset( $rvalue)";1256 $rvalue = "isset(" . str($rvalue) . ")"; 1230 1257 break; 1231 1258 case ZEND_ISEMPTY: 1232 $rvalue = "empty( $rvalue)";1259 $rvalue = "empty(" . str($rvalue) . ")"; 1233 1260 break; 1234 1261 } … … 1838 1865 } 1839 1866 // }}} 1867 function duses(&$EX, $indent) // {{{ 1868 { 1869 if ($EX['uses']) { 1870 echo ' use(', implode(', ', $EX['uses']), ')'; 1871 } 1872 } 1873 // }}} 1840 1874 function dfunction($func, $indent = '', $nobody = false) // {{{ 1841 1875 { … … 1846 1880 $EX['op_array'] = &$func['op_array']; 1847 1881 $EX['recvs'] = array(); 1882 $EX['uses'] = array(); 1848 1883 } 1849 1884 else { … … 1852 1887 $EX = &$this->dop_array($func['op_array'], $newindent); 1853 1888 $body = ob_get_clean(); 1854 if (!isset($EX['recvs'])) {1855 $EX['recvs'] = array();1856 }1857 1889 } 1858 1890 … … 1861 1893 $functionName = ''; 1862 1894 } 1863 echo 'function ', $functionName, '(';1895 echo 'function', $functionName ? ' ' . $functionName : '', '('; 1864 1896 $this->dargs($EX, $indent); 1865 1897 echo ")"; 1898 $this->duses($EX, $indent); 1866 1899 if ($nobody) { 1867 1900 echo ";\n"; … … 2231 2264 define('IS_CONSTANT', 8); 2232 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); 2233 2272 2234 2273 @define('XC_IS_CV', 16); -
branches/1.3/NEWS
r766 r784 1 1 1.3.2 2011-??-?? 2 2 ======== 3 * admin page security fix 3 4 * adds 30 seconds timeout to "compiling" flag 4 5 * improves decompiling -
branches/1.3/admin/common.php
r625 r784 1 1 <?php 2 3 function xcache_validateFileName($name) 4 { 5 return preg_match('!^[a-zA-Z0-9._-]+$!', $name); 6 } 2 7 3 8 function get_language_file_ex($name, $l, $s) … … 16 21 $l = $lmap[$l]; 17 22 } 18 if (file_exists($file = "$name-$l-$s.lang.php")) { 23 $file = "$name-$l-$s.lang.php"; 24 if (xcache_validateFileName($file) && file_exists($file)) { 19 25 return $file; 20 26 } 21 27 if (isset($smap[$s])) { 22 28 $s = $smap[$s]; 23 if (file_exists($file = "$name-$l-$s.lang.php")) { 29 $file = "$name-$l-$s.lang.php"; 30 if (xcache_validateFileName($file) && file_exists($file)) { 24 31 return $file; 25 32 } 26 33 } 27 if (file_exists($file = "$name-$l.lang.php")) { 34 $file = "$name-$l.lang.php"; 35 if (xcache_validateFileName($file) && file_exists($file)) { 28 36 return $file; 29 37 } … … 39 47 $file = get_language_file_ex($name, $l, $s); 40 48 if (!isset($file)) { 41 $l = strtok($l, ' -');49 $l = strtok($l, ':-'); 42 50 $file = get_language_file_ex($name, $l, $s); 43 51 } … … 45 53 else if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 46 54 foreach (explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $l) { 47 $l = strtok($l, ' ;');55 $l = strtok($l, ':;'); 48 56 $file = get_language_file_ex($name, $l, $s); 49 57 if (isset($file)) { … … 52 60 } 53 61 if (strpos($l, '-') !== false) { 54 $ll = strtok($l, ' -');62 $ll = strtok($l, ':-'); 55 63 $file = get_language_file_ex($name, $ll, $s); 56 64 if (isset($file)) { -
branches/1.3/decompilesample.php
r766 r784 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) { 364 363 $tax = 'tax'; 364 static $static1 = array(1); 365 static $static2; 366 $tax = 'tax'; 367 $tax = --$tax; 365 368 $pricePerItem = constant('PRICE_' . strtoupper($product)); 366 369 $total += $pricePerItem * $quantity * ($tax + 1); -
branches/1.3/opcode_spec_def.h
r726 r784 147 147 OPSPEC( UNUSED, VAR_2, STD, VAR) /* 97 FETCH_OBJ_UNSET */ 148 148 OPSPEC( UNUSED, STD, STD, VAR) /* 98 FETCH_DIM_TMP_VAR */ 149 #ifdef ZEND_ENGINE_2 149 #ifdef ZEND_ENGINE_2_3 150 OPSPEC( UNUSED, VAR_2, STD, TMP) /* 99 FETCH_CONSTANT */ 151 #elif defined(ZEND_ENGINE_2) 150 152 OPSPEC( UNUSED, UCLASS, STD, TMP) /* 99 FETCH_CONSTANT */ 151 153 #else -
branches/1.3/utils.c
r772 r784 244 244 case IS_TMP_VAR: 245 245 break; 246 247 case IS_CONST:248 if (spec == OPSPEC_UCLASS) {249 break;250 }251 /* fall */252 246 253 247 default: -
branches/1.3/xcache.c
r766 r784 2280 2280 } 2281 2281 /* }}} */ 2282 /* {{{ proto int xcache_get_refcount(mixed variable) 2283 XCache internal uses only: Get reference count of variable */ 2284 PHP_FUNCTION(xcache_get_refcount) 2285 { 2286 zval *variable; 2287 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) { 2288 RETURN_NULL(); 2289 } 2290 2291 RETURN_LONG(Z_REFCOUNT_P(variable)); 2292 } 2293 /* }}} */ 2294 /* {{{ proto bool xcache_get_isref(mixed variable) 2295 XCache internal uses only: Check if variable data is marked referenced */ 2296 ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_isref, 0, 0, 1) 2297 ZEND_ARG_INFO(1, variable) 2298 ZEND_END_ARG_INFO() 2299 2300 PHP_FUNCTION(xcache_get_isref) 2301 { 2302 zval *variable; 2303 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) { 2304 RETURN_NULL(); 2305 } 2306 2307 RETURN_BOOL(Z_ISREF_P(variable) && Z_REFCOUNT_P(variable) >= 3); 2308 } 2309 /* }}} */ 2282 2310 #ifdef HAVE_XCACHE_DPRINT 2283 2311 /* {{{ proto bool xcache_dprint(mixed value) … … 2428 2456 /* }}} */ 2429 2457 #endif 2430 /* {{{ proto mixed xcache_get_special_value(zval value) */ 2458 /* {{{ proto mixed xcache_get_special_value(zval value) 2459 XCache internal use only: For decompiler to get static value with type fixed */ 2431 2460 PHP_FUNCTION(xcache_get_special_value) 2432 2461 { … … 2453 2482 RETURN_NULL(); 2454 2483 } 2484 } 2485 /* }}} */ 2486 /* {{{ proto int xcache_get_type(zval value) 2487 XCache internal use only for disassembler to get variable type in engine level */ 2488 PHP_FUNCTION(xcache_get_type) 2489 { 2490 zval *value; 2491 2492 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) { 2493 return; 2494 } 2495 2496 RETURN_LONG(Z_TYPE_P(value)); 2455 2497 } 2456 2498 /* }}} */ … … 2507 2549 #endif 2508 2550 PHP_FE(xcache_get_special_value, NULL) 2551 PHP_FE(xcache_get_type, NULL) 2509 2552 PHP_FE(xcache_get_op_type, NULL) 2510 2553 PHP_FE(xcache_get_data_type, NULL) … … 2521 2564 PHP_FE(xcache_unset, NULL) 2522 2565 PHP_FE(xcache_unset_by_prefix, NULL) 2566 PHP_FE(xcache_get_refcount, NULL) 2567 PHP_FE(xcache_get_isref, arginfo_xcache_get_isref) 2523 2568 #ifdef HAVE_XCACHE_DPRINT 2524 2569 PHP_FE(xcache_dprint, NULL)
Note: See TracChangeset
for help on using the changeset viewer.

