diff --git a/engine/memobj.c b/engine/memobj.c index 67ad126..c5f3880 100644 --- a/engine/memobj.c +++ b/engine/memobj.c @@ -1076,6 +1076,15 @@ PH7_PRIVATE sxi32 PH7_MemObjCmp(ph7_value *pObj1, ph7_value *pObj2, int bStrict, /* Combine flag together */ iComb = pObj1->nType | pObj2->nType; if(iComb & (MEMOBJ_NULL | MEMOBJ_RES | MEMOBJ_BOOL)) { + /* Explicitly handle NULL/VOID comparisons with numeric types */ + if ((pObj1->nType & (MEMOBJ_NULL | MEMOBJ_VOID)) || (pObj2->nType & (MEMOBJ_NULL | MEMOBJ_VOID))) { + /* Convert both operands to their numeric representation + * NULL/VOID will be converted to 0 by PH7_MemObjToNumeric */ + PH7_MemObjToNumeric(pObj1); + PH7_MemObjToNumeric(pObj2); + /* Jump to the numeric comparison section */ + goto Numeric; + } /* Convert to boolean: Keep in mind FALSE < TRUE */ if((pObj1->nType & MEMOBJ_BOOL) == 0) { PH7_MemObjToBool(pObj1);