mirror of
https://github.com/smarty-php/smarty.git
synced 2025-07-30 07:57:14 +02:00
1
changelog/1074.md
Normal file
1
changelog/1074.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- Fix PHP backtraces by qualifying/replacing `call_user_func_array` calls [#1074](https://github.com/smarty-php/smarty/issues/1074)
|
@ -14,6 +14,6 @@ class BlockPluginWrapper extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function handle($params, $content, Template $template, &$repeat) {
|
public function handle($params, $content, Template $template, &$repeat) {
|
||||||
return call_user_func_array($this->callback, [$params, $content, &$template, &$repeat]);
|
return \call_user_func_array($this->callback, [$params, $content, &$template, &$repeat]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -665,7 +665,7 @@ class Template extends BaseCompiler {
|
|||||||
$script = null;
|
$script = null;
|
||||||
$cacheable = true;
|
$cacheable = true;
|
||||||
|
|
||||||
$result = call_user_func_array(
|
$result = \call_user_func_array(
|
||||||
$defaultPluginHandlerFunc,
|
$defaultPluginHandlerFunc,
|
||||||
[
|
[
|
||||||
$tag,
|
$tag,
|
||||||
@ -1281,9 +1281,10 @@ class Template extends BaseCompiler {
|
|||||||
}
|
}
|
||||||
// call post compile callbacks
|
// call post compile callbacks
|
||||||
foreach ($this->postCompileCallbacks as $cb) {
|
foreach ($this->postCompileCallbacks as $cb) {
|
||||||
$parameter = $cb;
|
$callbackFunction = $cb[0];
|
||||||
$parameter[0] = $this;
|
$parameters = $cb;
|
||||||
call_user_func_array($cb[0], $parameter);
|
$parameters[0] = $this;
|
||||||
|
$callbackFunction(...$parameters);
|
||||||
}
|
}
|
||||||
// return compiled code
|
// return compiled code
|
||||||
return $this->prefixCompiledCode . $this->parser->retvalue . $this->postfixCompiledCode;
|
return $this->prefixCompiledCode . $this->parser->retvalue . $this->postfixCompiledCode;
|
||||||
|
@ -26,7 +26,7 @@ class CallbackWrapper {
|
|||||||
|
|
||||||
public function handle(...$params) {
|
public function handle(...$params) {
|
||||||
try {
|
try {
|
||||||
return call_user_func_array($this->callback, $params);
|
return ($this->callback)(...$params);
|
||||||
} catch (\ArgumentCountError $e) {
|
} catch (\ArgumentCountError $e) {
|
||||||
throw new Exception("Invalid number of arguments to modifier " . $this->modifierName);
|
throw new Exception("Invalid number of arguments to modifier " . $this->modifierName);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class DefaultPluginHandlerRuntime {
|
|||||||
$script = null;
|
$script = null;
|
||||||
$cacheable = null;
|
$cacheable = null;
|
||||||
|
|
||||||
return (call_user_func_array(
|
return (\call_user_func_array(
|
||||||
$this->defaultPluginHandler,
|
$this->defaultPluginHandler,
|
||||||
[
|
[
|
||||||
$tag,
|
$tag,
|
||||||
@ -54,7 +54,7 @@ class DefaultPluginHandlerRuntime {
|
|||||||
$script = null;
|
$script = null;
|
||||||
$cacheable = null;
|
$cacheable = null;
|
||||||
|
|
||||||
if (call_user_func_array(
|
if (\call_user_func_array(
|
||||||
$this->defaultPluginHandler,
|
$this->defaultPluginHandler,
|
||||||
[
|
[
|
||||||
$tag,
|
$tag,
|
||||||
|
@ -203,7 +203,7 @@ class Source {
|
|||||||
*/
|
*/
|
||||||
public function _getDefaultTemplate($default_handler) {
|
public function _getDefaultTemplate($default_handler) {
|
||||||
$_content = $_timestamp = null;
|
$_content = $_timestamp = null;
|
||||||
$_return = call_user_func_array(
|
$_return = \call_user_func_array(
|
||||||
$default_handler,
|
$default_handler,
|
||||||
[$this->type, $this->name, &$_content, &$_timestamp, $this->smarty]
|
[$this->type, $this->name, &$_content, &$_timestamp, $this->smarty]
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user