From 71137b9c29f1c1eb9a4f53d012e8548611f8e0d6 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Tue, 27 May 2014 15:54:45 +0000 Subject: [PATCH] fix build for pre-5.6 git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1489 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- devel/sample.cpp.php | 2 ++ lib/Decompiler.class.php | 8 ++++---- xcache/xc_compatibility.h | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/devel/sample.cpp.php b/devel/sample.cpp.php index 5e3264b..7a90d8c 100644 --- a/devel/sample.cpp.php +++ b/devel/sample.cpp.php @@ -44,12 +44,14 @@ abstract class ClassName static public $static_const10 = array(CONST_VALUE => CONST_VALUE); static public $static_const11 = array(self::CONST_VALUE => self::CONST_VALUE); static public $static_const12 = array(ClassName::CONST_VALUE => ClassName::CONST_VALUE); +#if PHP_VERSION >= 560 static public $ast_binop = ClassName::CONST_VALUE + ClassName::CONST_VALUE; static public $ast_and = ClassName::CONST_VALUE && 1; static public $ast_or = ClassName::CONST_VALUE || 2; static public $ast_select = ClassName::CONST_VALUE ? a : b; static public $ast_unaryPlus = +ClassName::CONST_VALUE; static public $ast_unaryMinus = -ClassName::CONST_VALUE; +#endif /** doc */ static public $public_static = array(2, 'str'); /** doc */ diff --git a/lib/Decompiler.class.php b/lib/Decompiler.class.php index de1e2c0..48f7eb8 100644 --- a/lib/Decompiler.class.php +++ b/lib/Decompiler.class.php @@ -648,11 +648,11 @@ class Decompiler XC_JMP_SET_VAR => "?:", XC_JMPZ_EX => "&&", XC_JMPNZ_EX => "||", - - // zend_ast - ZEND_BOOL_AND => '&&', - ZEND_BOOL_OR => '||', ); + if (defined('IS_CONSTANT_AST')) { + $this->binops[ZEND_BOOL_AND] = '&&'; + $this->binops[ZEND_BOOL_OR] = '||'; + } // }}} $this->includeTypes = array( // {{{ ZEND_EVAL => 'eval', diff --git a/xcache/xc_compatibility.h b/xcache/xc_compatibility.h index 8d522c5..9fad4db 100644 --- a/xcache/xc_compatibility.h +++ b/xcache/xc_compatibility.h @@ -98,6 +98,10 @@ static inline void xc_add_assoc_null_ex(zval *arg, char *key, uint key_len) #endif /* }}} */ +#ifndef ZEND_ENGINE_2_6 +typedef void zend_ast; +#endif + #ifdef ZEND_ENGINE_2_4 # define Z_OP(op) (op) # define Z_OP_CONSTANT(op) (op).literal->constant