Fix @array[key]

This commit is contained in:
cmp167
2023-09-10 01:11:00 +12:00
parent 8f803e6c06
commit 42bba9d1be

View File

@@ -193,7 +193,7 @@
$this->appendConf($obj);
if(@$this->parm["timezone"]) {
if(isset($this->parm["timezone"]) && $this->parm["timezone"]) {
$this->d("Set timezone '" . $this->parm["timezone"] . "'");
date_default_timezone_set($this->parm["timezone"]);
}
@@ -202,7 +202,7 @@
$this->parm["maxFileSize"] = 1048576;
$this->d("Set maxFileSize '" . $this->parm["maxFileSize"] . "'");
if(is_array(@$this->parm["php_ini"])) {
if(isset($this->parm["php_ini"]) && is_array($this->parm["php_ini"])) {
foreach($this->parm["php_ini"] as $k => $v) {
ini_set($k, $v);
}
@@ -403,10 +403,15 @@
function cmpSysExecEventSwo(&$ppsAll, &$opt) {
do {
if(!@$opt["stdInEventAdd"])
if(!isset($opt["stdInEventAdd"]) || !$opt["stdInEventAdd"])
break;
if(!is_callable(@$opt["stdInEventAdd"]["call"])) {
if(!isset($opt["stdInEventAdd"]["call"])) {
$this->d("Unset callable stdInEventAdd");
break;
}
if(!is_callable($opt["stdInEventAdd"]["call"])) {
$this->d("Invalid callable stdInEventAdd");
break;
}
@@ -421,10 +426,15 @@
} while(0);
do {
if(!@$opt["stdOutEventAdd"])
if(!isset($opt["stdOutEventAdd"]) || !$opt["stdOutEventAdd"])
break;
if(!is_callable(@$opt["stdOutEventAdd"]["call"])) {
if(!isset($opt["stdOutEventAdd"]["call"])) {
$this->d("Unset callable stdOutEventAdd");
break;
}
if(!is_callable($opt["stdOutEventAdd"]["call"])) {
$this->d("Invalid callable stdOutEventAdd");
break;
}
@@ -439,10 +449,15 @@
} while(0);
do {
if(!@$opt["stdErrEventAdd"])
if(!isset($opt["stdErrEventAdd"]) || !$opt["stdErrEventAdd"])
break;
if(!is_callable(@$opt["stdErrEventAdd"]["call"])) {
if(!isset($opt["stdErrEventAdd"]["call"])) {
$this->d("Unset callable stdErrEventAdd");
break;
}
if(!is_callable($opt["stdErrEventAdd"]["call"])) {
$this->d("Invalid callable stdErrEventAdd");
break;
}
@@ -460,14 +475,19 @@
if(!isset($opt["eventWait"]) || !$opt["eventWait"])
break;
if(!isset($opt["silent"]) || !$opt["silent"])
$this->d("Call eventWait");
if(!isset($opt["eventWait"]["call"])) {
$this->d("Unset callable eventWait");
break;
}
if(!is_callable(@$opt["eventWait"]["call"])) {
if(!is_callable($opt["eventWait"]["call"])) {
$this->d("Invalid callable eventWait");
break;
}
if(!isset($opt["silent"]) || !$opt["silent"])
$this->d("Call eventWait");
($opt["eventWait"]["call"])();
} while(0);
@@ -528,7 +548,7 @@
stream_set_blocking($ppsAll[1], $blk);
stream_set_blocking($ppsAll[2], $blk);
if(@$opt["stdin"]) {
if(isset($opt["stdin"]) && $opt["stdin"]) {
fwrite($ppsAll[0], $opt["stdin"]);
fclose($ppsAll[0]);
}
@@ -564,10 +584,10 @@
$val = 0;
if(@$opt["retval"])
if(isset($opt["retval"]) && $opt["retval"])
$val = $opt["retval"];
if(!@$opt["noerror"]) {
if(!isset($opt["noerror"]) || !$opt["noerror"]) {
if($retVal !== $val) {
if(!isset($opt["silent"]) || !$opt["silent"]) {
$this->d($err);
@@ -582,17 +602,18 @@
}
}
if(isset($opt["return"]) && $opt["return"]) {
switch(@$opt["return"]) {
case "retval":
return 1*$retVal;
switch(@$opt["return"]) {
case "retval":
return 1*$retVal;
case "outstr":
return $out;
case "outstr":
return $out;
case "outarr":
default:
return explode("\n", $out);
case "outarr":
default:
return explode("\n", $out);
}
}
return explode("\n", $out);