|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Dec 17, 2016 11:15 pm Post subject: Critical bug in modifier plugin compiler. |
|
|
Closures aren't compiled properly, resulting in empty callable's name.
Quick and dirty patch:
Code: | --- libs/sysplugins/smarty_internal_compile_private_modifier.php 2016-08-07 21:46:49.000000000 +0300
+++ libs/sysplugins/smarty_internal_compile_private_modifier.php 2016-12-18 01:46:56.000000000 +0300
@@ -48,21 +48,14 @@
case 1:
// registered modifier
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
- $function =
- $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
- if (!is_array($function)) {
- $output = "{$function}({$params})";
- } else {
- if (is_object($function[ 0 ])) {
- $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
- $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
- } else {
- $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
- }
- }
+ if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) {
+ $output =
+ sprintf('call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], [ %s ])',
+ Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params);
$compiler->known_modifier_type[ $modifier ] = $type;
break 2;
}
+ }
break;
case 2:
// registered modifier compiler
|
|
|
Back to top |
|
Eithan Smarty n00b
Joined: 04 Jun 2018 Posts: 1
|
Posted: Mon Jun 04, 2018 10:46 am Post subject: |
|
|
Just what I was searching for.. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Jun 04, 2018 4:58 pm Post subject: |
|
|
Elaborate, please. The bug was fixed years ago. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jun 06, 2018 3:05 pm Post subject: |
|
|
Closing as outdated to prevent spam. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|