Support the use of global (or other) variables in "arg" method

This commit is contained in:
Bofh 2022-12-24 01:51:03 +01:00
parent 5022d34c28
commit 26871ff539
1 changed files with 3 additions and 2 deletions

View File

@ -77,7 +77,7 @@ function no_http() {
function arg($arg, $default=null, $validator=null) {
$arg = trim($arg);
$type = 'string';
$type = null;
$require = false;
if (strpos($arg,'*') === 0) {
@ -116,6 +116,7 @@ function arg($arg, $default=null, $validator=null) {
if ($value === null)
return !$require ? $default : apiresult(['error' => '<'.$arg.'> parameter must be specified'], 400);
if (gettype($value) === 'string')
$value = trim($value);
if ($type === 'string')
$value = strval($value);