Source
$parameters[] = $param['type'] == self::PARAM_QUOTED ? $this->unquoteParam($param['raw']) : $param['raw'];
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* Class is used to validate and parse a trigger function.
*/
class C10FunctionParser extends CParser {
const STATE_NEW = 0;
const STATE_END = 1;
const STATE_UNQUOTED = 2;
const STATE_QUOTED = 3;
const STATE_END_OF_PARAMS = 4;
const PARAM_ARRAY = 0;
const PARAM_UNQUOTED = 1;
const PARAM_QUOTED = 2;
private $function = '';
private $parameters = '';
private $params_raw = [];
/**
* Returns true if the char is allowed in the function name, false otherwise.
*
* @param string $c
*
* @return bool
*/
protected function isFunctionChar($c) {
return ($c >= 'a' && $c <= 'z');
}
/**
* Parse a trigger function and parameters and put them into $this->params_raw array.
*
* @param string $source
* @param int $pos
*/
public function parse($source, $pos = 0) {
$this->length = 0;
$this->match = '';
$this->function = '';
$this->parameters = '';
$this->params_raw = [];
for ($p = $pos; isset($source[$p]) && $this->isFunctionChar($source[$p]); $p++) {
}
if ($p == $pos) {