Added new function used to escape and concatenate message parameters: old function raises a warning in newer PHP versions.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6534 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2022-01-04 13:44:35 +00:00
parent 4de9059a6c
commit 2799ffcfdd
1 changed files with 11 additions and 6 deletions

View File

@ -316,9 +316,7 @@ class Yate
$t=(int)$this->origin;
$n=Yate::Escape($this->name);
$r=Yate::Escape($this->retval);
$p="";
$pa = array(&$p);
array_walk($this->params, "_yate_message_walk", $pa);
$p = _yate_escaped_params($this->params);
_yate_print("%%>message:$i:$t:$n:$r$p\n");
$this->type="dispatched";
}
@ -337,9 +335,7 @@ class Yate
$k=Yate::Bool2str($this->handled);
$n=Yate::Escape($this->name);
$r=Yate::Escape($this->retval);
$p="";
$pa = array(&$p);
array_walk($this->params, "_yate_message_walk", $pa);
$p = _yate_escaped_params($this->params);
_yate_print("%%<message:$i:$k:$n:$r$p\n");
$this->type="acknowledged";
}
@ -599,6 +595,15 @@ function _yate_print($str)
}
}
// Internal function: escape and concatenate a list of parameters
function _yate_escaped_params($params)
{
$ep = "";
foreach ($params as $key=>$item)
$ep .= ':' . Yate::Escape($key,'=') . '=' . Yate::Escape($item);
return $ep;
}
/* Internal function */
function _yate_message_walk($item, $key, &$result)
{