Changeset 1374 in svn for trunk


Ignore:
Timestamp:
2013-09-16T15:48:48Z (2 years ago)
Author:
Xuefer
Message:

Decompiler: fixes #318 (support for const in static array index/value)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Decompiler.class.php

    r1343 r1374  
    9090function value($value, &$EX) // {{{
    9191{
    92     $spec = xcache_get_special_value($value);
    93     if (isset($spec)) {
    94         $value = $spec;
    95         if (!is_array($value)) {
     92    $originalValue = xcache_get_special_value($value);
     93    if (isset($originalValue)) {
     94        if ((xcache_get_type($value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
    9695            // constant
    97             return $GLOBALS['__xcache_decompiler']->stripNamespace($value);
    98         }
     96            return $GLOBALS['__xcache_decompiler']->stripNamespace($originalValue);
     97        }
     98
     99        $value = $originalValue;
    99100    }
    100101
  • trunk/mod_disassembler/sample.cpp.php

    r1373 r1374  
    3131        CONST_VALUE => CONST_VALUE
    3232        );
    33     static public $static2 = array(self::CONST_VALUE => self::CONST_VALUE);
     33    static public $static_const1 = CONST_VALUE;
     34    static public $static_const2 = self::CONST_VALUE;
     35    static public $static_const3 = ClassName::CONST_VALUE;
     36    static public $static_const4 = array(CONST_VALUE => 'test');
     37    static public $static_const5 = array(self::CONST_VALUE => 'test');
     38    static public $static_const6 = array(ClassName::CONST_VALUE => 'test');
     39    static public $static_const7 = array('test' => CONST_VALUE);
     40    static public $static_const8 = array('test' => self::CONST_VALUE);
     41    static public $static_const9 = array('test' => ClassName::CONST_VALUE);
     42    static public $static_const10 = array(CONST_VALUE => CONST_VALUE);
     43    static public $static_const11 = array(self::CONST_VALUE => self::CONST_VALUE);
     44    static public $static_const12 = array(ClassName::CONST_VALUE => ClassName::CONST_VALUE);
    3445    /** doc */
    3546    static public $public_static = array(2, 'str');
  • trunk/xcache.c

    r1346 r1374  
    351351
    352352    default:
    353         RETURN_NULL();
     353        if ((Z_TYPE_P(value) & ~IS_CONSTANT_TYPE_MASK)) {
     354            *return_value = *value;
     355            zval_copy_ctor(return_value);
     356            return_value->type &= IS_CONSTANT_TYPE_MASK;
     357        }
     358        else {
     359            RETURN_NULL();
     360        }
    354361    }
    355362}
Note: See TracChangeset for help on using the changeset viewer.