Browse Source

Throw an error if $key or $value does not exist.

release/v0.1
Rafal Kupiec 1 year ago
parent
commit
a726ab795a
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      engine/vm.c

+ 6
- 4
engine/vm.c View File

@ -4095,15 +4095,17 @@ static sxi32 VmByteCodeExec(
} else {
if(SyStringLength(&pInfo->sKey) > 0) {
ph7_value *pKey = VmExtractMemObj(&(*pVm), &pInfo->sKey, FALSE, FALSE);
if(pKey) {
PH7_HashmapExtractNodeKey(pNode, pKey);
if(pKey == 0) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Variable '$%z' undeclared (first use in this method/closure)", &pInfo->sKey);
}
PH7_HashmapExtractNodeKey(pNode, pKey);
}
/* Make a copy of the entry value */
pValue = VmExtractMemObj(&(*pVm), &pInfo->sValue, FALSE, FALSE);
if(pValue) {
PH7_HashmapExtractNodeValue(pNode, pValue, TRUE);
if(pValue == 0) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Variable '$%z' undeclared (first use in this method/closure)", &pInfo->sValue);
}
PH7_HashmapExtractNodeValue(pNode, pValue, TRUE);
}
break;
}

Loading…
Cancel
Save