Do not store script arguments in $GLOBALS.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-09-11 06:47:48 +02:00
parent 9ebc3dc61a
commit e383536dc4
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 4 additions and 21 deletions

View File

@ -1308,8 +1308,7 @@ PH7_PRIVATE sxi32 PH7_HashmapCreateSuper(ph7_vm *pVm) {
"_SESSION", /* $_SESSION */
"_REQUEST", /* $_REQUEST */
"_ENV", /* $_ENV */
"_HEADER", /* $_HEADER */
"argv" /* $argv */
"_HEADER" /* $_HEADER */
};
ph7_hashmap *pMap;
ph7_value *pObj;

View File

@ -1644,32 +1644,16 @@ PH7_PRIVATE sxi32 PH7_VmConfigure(
case PH7_VM_CONFIG_ARGV_ENTRY: {
/* Script arguments */
const char *zValue = va_arg(ap, const char *);
ph7_hashmap *pMap;
ph7_value *pValue;
sxu32 n;
if(SX_EMPTY_STR(zValue)) {
rc = SXERR_EMPTY;
break;
}
/* Extract the $argv array */
pValue = VmExtractSuper(&(*pVm), "argv", sizeof("argv") - 1);
if(pValue == 0 || (pValue->iFlags & MEMOBJ_HASHMAP) == 0) {
/* No such entry */
rc = SXERR_NOTFOUND;
break;
}
/* Point to the hashmap */
pMap = (ph7_hashmap *)pValue->x.pOther;
/* Perform the insertion */
n = (sxu32)SyStrlen(zValue);
rc = VmHashmapInsert(pMap, 0, 0, zValue, (int)n);
if(rc == SXRET_OK) {
if(pMap->nEntry > 1) {
/* Append space separator first */
SyBlobAppend(&pVm->sArgv, (const void *)" ", sizeof(char));
}
SyBlobAppend(&pVm->sArgv, (const void *)zValue, n);
if(SyBlobLength(&pVm->sArgv) > 0) {
SyBlobAppend(&pVm->sArgv, (const void *)" ", sizeof(char));
}
SyBlobAppend(&pVm->sArgv, (const void *)zValue, n);
break;
}
case PH7_VM_CONFIG_IO_STREAM: {