From 9acd6fbcb2509dd84aece327bb34ca8959569340 Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 3 Apr 2019 09:34:32 +0200 Subject: [PATCH] Do not typecast NULL to StdClass. --- engine/memobj.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/memobj.c b/engine/memobj.c index 9f39a69..7a63c2b 100644 --- a/engine/memobj.c +++ b/engine/memobj.c @@ -580,7 +580,12 @@ PH7_PRIVATE sxi32 PH7_MemObjToHashmap(ph7_value *pObj) { * Refer to the official documentation for more information. */ PH7_PRIVATE sxi32 PH7_MemObjToObject(ph7_value *pObj) { - if((pObj->iFlags & MEMOBJ_OBJ) == 0) { + if(pObj->iFlags & MEMOBJ_NULL) { + /* Invalidate any prior representation */ + PH7_MemObjRelease(pObj); + /* Typecast the value */ + MemObjSetType(pObj, MEMOBJ_OBJ); + } else if((pObj->iFlags & MEMOBJ_OBJ) == 0) { ph7_class_instance *pStd; ph7_class_method *pCons; ph7_class *pClass;