Throw an error if $key or $value does not exist.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-05-01 09:51:33 +02:00
parent 5c1e0f0cce
commit a726ab795a
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 6 additions and 4 deletions

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;
}