The isset() function always results in true, thus it is useless. If passed as argument variable is not set, the interpreter will throw an error.
The build has failed.
Details
The build has failed.
Details
This commit is contained in:
parent
e75ed7b9a9
commit
4f29507c0d
|
@ -5325,9 +5325,9 @@ static ProcLangConstruct PH7_GenStateGetStatementHandler(
|
||||||
*/
|
*/
|
||||||
static int PH7_IsLangConstruct(sxu32 nKeywordID) {
|
static int PH7_IsLangConstruct(sxu32 nKeywordID) {
|
||||||
if(nKeywordID == PH7_KEYWORD_IMPORT || nKeywordID == PH7_KEYWORD_INCLUDE || nKeywordID == PH7_KEYWORD_REQUIRE
|
if(nKeywordID == PH7_KEYWORD_IMPORT || nKeywordID == PH7_KEYWORD_INCLUDE || nKeywordID == PH7_KEYWORD_REQUIRE
|
||||||
|| nKeywordID == PH7_KEYWORD_ISSET || nKeywordID == PH7_KEYWORD_EVAL || nKeywordID == PH7_KEYWORD_EMPTY
|
|| nKeywordID == PH7_KEYWORD_EVAL || nKeywordID == PH7_KEYWORD_EMPTY || nKeywordID == PH7_KEYWORD_SELF
|
||||||
|| nKeywordID == PH7_KEYWORD_SELF || nKeywordID == PH7_KEYWORD_PARENT || nKeywordID == PH7_KEYWORD_STATIC
|
|| nKeywordID == PH7_KEYWORD_PARENT || nKeywordID == PH7_KEYWORD_STATIC || nKeywordID == PH7_KEYWORD_NEW
|
||||||
|| nKeywordID == PH7_KEYWORD_NEW || nKeywordID == PH7_KEYWORD_CLONE) {
|
|| nKeywordID == PH7_KEYWORD_CLONE) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* Not a language construct */
|
/* Not a language construct */
|
||||||
|
|
|
@ -632,7 +632,6 @@ static sxu32 KeywordCode(const char *z, int n) {
|
||||||
{"exit", PH7_KEYWORD_EXIT},
|
{"exit", PH7_KEYWORD_EXIT},
|
||||||
{"import", PH7_KEYWORD_IMPORT},
|
{"import", PH7_KEYWORD_IMPORT},
|
||||||
{"include", PH7_KEYWORD_INCLUDE},
|
{"include", PH7_KEYWORD_INCLUDE},
|
||||||
{"isset", PH7_KEYWORD_ISSET},
|
|
||||||
{"require", PH7_KEYWORD_REQUIRE},
|
{"require", PH7_KEYWORD_REQUIRE},
|
||||||
{"return", PH7_KEYWORD_RETURN},
|
{"return", PH7_KEYWORD_RETURN},
|
||||||
};
|
};
|
||||||
|
|
38
engine/vm.c
38
engine/vm.c
|
@ -8270,43 +8270,6 @@ static int vm_builtin_exit(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||||
/* Abort processing immediately */
|
/* Abort processing immediately */
|
||||||
return PH7_ABORT;
|
return PH7_ABORT;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* bool isset($var,...)
|
|
||||||
* Finds out whether a variable is set.
|
|
||||||
* Parameters
|
|
||||||
* One or more variable to check.
|
|
||||||
* Return
|
|
||||||
* 1 if var exists and has value other than NULL, 0 otherwise.
|
|
||||||
*/
|
|
||||||
static int vm_builtin_isset(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
|
||||||
ph7_value *pObj;
|
|
||||||
int res = 0;
|
|
||||||
int i;
|
|
||||||
if(nArg < 1) {
|
|
||||||
/* Missing arguments,return false */
|
|
||||||
ph7_result_bool(pCtx, res);
|
|
||||||
return SXRET_OK;
|
|
||||||
}
|
|
||||||
/* Iterate over available arguments */
|
|
||||||
for(i = 0 ; i < nArg ; ++i) {
|
|
||||||
pObj = apArg[i];
|
|
||||||
if(pObj->nIdx == SXU32_HIGH) {
|
|
||||||
if((pObj->iFlags & MEMOBJ_NULL) == 0) {
|
|
||||||
/* Not so fatal,Throw a warning */
|
|
||||||
PH7_VmThrowError(pCtx->pVm, PH7_CTX_WARNING, "Expecting a variable not a constant");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res = (pObj->iFlags & MEMOBJ_NULL) ? 0 : 1;
|
|
||||||
if(!res) {
|
|
||||||
/* Variable not set,return FALSE */
|
|
||||||
ph7_result_bool(pCtx, 0);
|
|
||||||
return SXRET_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* All given variable are set,return TRUE */
|
|
||||||
ph7_result_bool(pCtx, 1);
|
|
||||||
return SXRET_OK;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Unset a memory object [i.e: a ph7_value],remove it from the current
|
* Unset a memory object [i.e: a ph7_value],remove it from the current
|
||||||
* frame,the reference table and discard it's contents.
|
* frame,the reference table and discard it's contents.
|
||||||
|
@ -10876,7 +10839,6 @@ static const ph7_builtin_func aVmFunc[] = {
|
||||||
{ "get_defined_vars", vm_builtin_get_defined_vars},
|
{ "get_defined_vars", vm_builtin_get_defined_vars},
|
||||||
{ "gettype", vm_builtin_gettype },
|
{ "gettype", vm_builtin_gettype },
|
||||||
{ "get_resource_type", vm_builtin_get_resource_type},
|
{ "get_resource_type", vm_builtin_get_resource_type},
|
||||||
{ "isset", vm_builtin_isset },
|
|
||||||
{ "unset", vm_builtin_unset },
|
{ "unset", vm_builtin_unset },
|
||||||
{ "var_dump", vm_builtin_var_dump },
|
{ "var_dump", vm_builtin_var_dump },
|
||||||
{ "print_r", vm_builtin_print_r },
|
{ "print_r", vm_builtin_print_r },
|
||||||
|
|
|
@ -1594,7 +1594,6 @@ enum ph7_expr_id {
|
||||||
#define PH7_KEYWORD_INCLUDE 41 /* include */
|
#define PH7_KEYWORD_INCLUDE 41 /* include */
|
||||||
#define PH7_KEYWORD_EMPTY 42 /* empty */
|
#define PH7_KEYWORD_EMPTY 42 /* empty */
|
||||||
#define PH7_KEYWORD_INSTANCEOF 0x400 /* instanceof: MUST BE A POWER OF TWO */
|
#define PH7_KEYWORD_INSTANCEOF 0x400 /* instanceof: MUST BE A POWER OF TWO */
|
||||||
#define PH7_KEYWORD_ISSET 43 /* isset */
|
|
||||||
#define PH7_KEYWORD_PARENT 44 /* parent */
|
#define PH7_KEYWORD_PARENT 44 /* parent */
|
||||||
#define PH7_KEYWORD_PRIVATE 45 /* private */
|
#define PH7_KEYWORD_PRIVATE 45 /* private */
|
||||||
#define PH7_KEYWORD_FOR 48 /* for */
|
#define PH7_KEYWORD_FOR 48 /* for */
|
||||||
|
|
Loading…
Reference in New Issue