Browse Source

Decompiler: support for const in static array index; TODO: PHP 5.0- support for static array

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1343 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.1
Xuefer 7 years ago
parent
commit
a0217c2654
2 changed files with 26 additions and 4 deletions
  1. +16
    -2
      lib/Decompiler.class.php
  2. +10
    -2
      mod_disassembler/sample.cpp.php

+ 16
- 2
lib/Decompiler.class.php View File

@ -279,7 +279,11 @@ class Decompiler_Fetch extends Decompiler_Code // {{{
case ZEND_FETCH_STATIC:
if (ZEND_ENGINE_2_3) {
// closure local variable?
return str($this->src);
return 'STR' . str($this->src);
}
else {
$EX = array();
return str(value($this->src, $EX));
}
die('static fetch cant to string');
case ZEND_FETCH_GLOBAL:
@ -491,7 +495,17 @@ class Decompiler_ConstArray extends Decompiler_Array // {{{
{
$elements = array();
foreach ($array as $key => $value) {
$elements[] = array(value($key, $EX), value($value, $EX));
if ((xcache_get_type($value) & IS_CONSTANT_INDEX)) {
$keyCode = $GLOBALS['__xcache_decompiler']->stripNamespace(
ZEND_ENGINE_2_3
? substr($key, 0, -2)
: $key
);
}
else {
$keyCode = value($key, $EX);
}
$elements[] = array($keyCode, value($value, $EX));
}
$this->value = $elements;
}


+ 10
- 2
mod_disassembler/sample.cpp.php View File

@ -26,8 +26,9 @@ abstract class ClassName
/** doc */
static public $static = array(
array('array'),
'str'
0 => array('array'),
1 => 'str',
CONST_VALUE => CONST_VALUE
);
/** doc */
static public $public_static = array(2, 'str');
@ -58,6 +59,13 @@ abstract class ClassName
#endif
PublicMethod function __construct($a, $b)
{
static $array = array(
0 => array('array'),
1 => 'str',
CONST_VALUE => CONST_VALUE
);
static $a = 1;
static $str = 'string';
echo CONST_VALUE;
#if PHP_VERSION >= 500
echo ClassName::CONST_VALUE;


Loading…
Cancel
Save