[PHP] 纯文本查看 复制代码
<?php
////////////////////////////////////////////////////////////
//修复ISSET EMPTY 丢失!
//XCACHE DECOMPILER
////////////////////////////////////////////////////////////
//How to work with this CLASS:
//cmd line>php phpdc.phpr file.php>file.txt
////////////////////////////////////////////////////////////
define('INDENT', "\t");
ini_set('error_reporting', E_ALL);
$_CURRENT_FILE = NULL;
function color($str, $color = 33) {
return "\x1B[{$color}m$str\x1B[0m";
}
function str($code, $indent = '') // {{{
{
if (is_array($code)) {
$array = array();
foreach ($code as $key => $value) {
$array[$key] = str($value, $indent);
}
return $array;
}
if (is_object($code)) {
$code = foldToCode($code, $indent);
return $code->toCode($indent);
}
return (string) $code;
}
// }}}
function foldToCode($src, $indent = '') // {{{ wrap or rewrap anything to Decompiler_Code
{
if (is_array($indent)) {
$indent = $indent['indent'];
}
if (!is_object($src)) {
return new Decompiler_Code($src);
}
if (!method_exists($src, 'toCode')) {
var_dump($src);
exit('no toCode');
}
if (get_class($src) != 'Decompiler_Code') {
// rewrap it
$src = new Decompiler_Code($src->toCode($indent));
}
return $src;
}
// }}}
function value($value,$noescape = false) // {{{
{
$spec = xcache_get_special_value($value);
if (isset($spec)) {
$value = $spec;
if (!is_array($value)) {
// constant
return $value;
}
}
if (is_a($value, 'Decompiler_Object')) {
// use as is
}
else {
if (is_array($value)) {
$value = new Decompiler_ConstArray($value);
}
else {
$value = new Decompiler_Value($value,$noescape);
}
}
return $value;
}
太长了,此处省略部分内容
define('ZEND_EVAL', (1 << 0));
define('ZEND_INCLUDE', (1 << 1));
define('ZEND_INCLUDE_ONCE', (1 << 2));
define('ZEND_REQUIRE', (1 << 3));
define('ZEND_REQUIRE_ONCE', (1 << 4));
/*
define('ZEND_ISSET', (1 << 0));
define('ZEND_ISEMPTY', (1 << 1));
define('ZEND_QUICK_SET',(1<<2));
define('ZEND_ISSET_ISEMPTY_MASK',(ZEND_ISSET | ZEND_ISEMPTY));
*/
if (ZEND_ENGINE_2_4) {
define('ZEND_ISSET', 0x02000000);
define('ZEND_ISEMPTY', 0x01000000);
define('ZEND_ISSET_ISEMPTY_MASK', (ZEND_ISSET | ZEND_ISEMPTY));
define('ZEND_QUICK_SET', 0x00800000);
} else {
define('ZEND_ISSET', (1 << 0));
define('ZEND_ISEMPTY', (1 << 1));
define('ZEND_ISSET_ISEMPTY_MASK', (ZEND_ISSET | ZEND_ISEMPTY));
}
if (ZEND_ENGINE_2_4) {
define('EXT_TYPE_UNUSED', (1 << 5));
}
else {
define('EXT_TYPE_UNUSED', (1 << 0));
}
define('ZEND_FETCH_STANDARD', 0);
define('ZEND_FETCH_ADD_LOCK', (ZEND_ENGINE_2_3 || ZEND_ENGINE_2_4 ? 0x08000000 : 1));
define('ZEND_FETCH_MAKE_REF', 0x04000000);
define('ZEND_FE_FETCH_BYREF', 1);
define('ZEND_FE_FETCH_WITH_KEY', 2);
define('ZEND_FE_RESET_REFERENCE', 2);
define('ZEND_MEMBER_FUNC_CALL', (1 << 0));
define('ZEND_CTOR_CALL', (1 << 1));
define('ZEND_ARG_SEND_BY_REF', (1 << 0));
define('ZEND_ARG_COMPILE_TIME_BOUND', (1 << 1));
define('ZEND_ARG_SEND_FUNCTION', (1 << 2));
define('BYREF_NONE', 0);
define('BYREF_FORCE', 1);
define('BYREF_ALLOW', 2);
define('BYREF_FORCE_REST', 3);
define('IS_NULL', 0);
define('IS_LONG', 1);
define('IS_DOUBLE', 2);
define('IS_BOOL', (ZEND_ENGINE_2 ? 3 : 6));
define('IS_ARRAY', 4);
define('IS_OBJECT', 5);
define('IS_STRING', (ZEND_ENGINE_2 ? 6 : 3));
define('IS_RESOURCE', 7);
define('IS_CONSTANT', 8);
define('IS_CONSTANT_ARRAY', 9);
/* Ugly hack to support constants as static array indices */
define('IS_CONSTANT_TYPE_MASK', 0x0f);
define('IS_CONSTANT_UNQUALIFIED', 0x10);
define('IS_CONSTANT_INDEX', 0x80);
define('IS_LEXICAL_VAR', 0x20);
define('IS_LEXICAL_REF', 0x40);
@define('XC_IS_CV', 16);
/*
if (preg_match_all('!XC_[A-Z_]+!', file_get_contents(__FILE__), $ms)) {
$verdiff = array();
foreach ($ms[0] as $k) {
if (!defined($k)) {
$verdiff[$k] = -1;
define($k, -1);
}
}
var_export($verdiff);
}
/*/
foreach (array(
'XC_HANDLE_EXCEPTION' => -1,
'XC_FETCH_CLASS' => -1,
'XC_FETCH_' => -1,
'XC_FETCH_DIM_' => -1,
'XC_ASSIGN_DIM' => -1,
'XC_UNSET_DIM' => -1,
'XC_UNSET_OBJ' => -1,
'XC_ASSIGN_OBJ' => -1,
'XC_ISSET_ISEMPTY_DIM_OBJ' => -1,
'XC_ISSET_ISEMPTY_PROP_OBJ' => -1,
'XC_ISSET_ISEMPTY_VAR' => -1,
'XC_INIT_STATIC_METHOD_CALL' => -1,
'XC_INIT_METHOD_CALL' => -1,
'XC_VERIFY_ABSTRACT_CLASS' => -1,
'XC_DECLARE_CLASS' => -1,
'XC_DECLARE_INHERITED_CLASS' => -1,
'XC_DECLARE_INHERITED_CLASS_DELAYED' => -1,
'XC_ADD_INTERFACE' => -1,
'XC_POST_DEC_OBJ' => -1,
'XC_POST_INC_OBJ' => -1,
'XC_PRE_DEC_OBJ' => -1,
'XC_PRE_INC_OBJ' => -1,
'XC_UNSET_OBJ' => -1,
'XC_JMP_NO_CTOR' => -1,
'XC_FETCH_' => -1,
'XC_FETCH_DIM_' => -1,
'XC_UNSET_DIM_OBJ' => -1,
'XC_ISSET_ISEMPTY' => -1,
'XC_INIT_FCALL_BY_FUNC' => -1,
'XC_DO_FCALL_BY_FUNC' => -1,
'XC_DECLARE_FUNCTION_OR_CLASS' => -1,
'XC_INIT_NS_FCALL_BY_NAME' => -1,
'XC_GOTO' => -1,
'XC_CATCH' => -1,
'XC_THROW' => -1,
'XC_INSTANCEOF' => -1,
'XC_DECLARE_FUNCTION' => -1,
'XC_RAISE_ABSTRACT_ERROR' => -1,
'XC_DECLARE_CONST' => -1,
'XC_USER_OPCODE' => -1,
'XC_JMP_SET' => -1,
'XC_RETURN_BY_REF' => -1,
'XC_GENERATOR_RETURN' => -1,
'XC_SEPARATE' => -1,
'XC_DECLARE_LAMBDA_FUNCTION' => -1,
) as $k => $v) {
if (!defined($k)) {
define($k, $v);
}
}
// }}}