Failure when .hlp files contain php functions like array_key_exists
I think this is from https://github.com/civicrm/civicrm-core/pull/29851 where it changes to use parseOneOffStringThroughSmarty which runs in secure mode because in general it handles user-entered strings. So for example templates/CRM/Core/Form/RecurringEntity.hlp which appears in the "Repeat Activity" section on activities gives the below error.
In this particular file, I'm not sure why it even needs to be conditional because the resulting strings would have blank words in them which would , confusing. Why would there be a place using this that wouldn't have set the variable?
I'd even think about going further and just removing most of this help text. Does something like You would select options "1 month", if your activity occurs every month
really add that much to the UX?
CRM_Core_Exception: Message was not parsed due to invalid smarty syntax : Smarty error: [in evaluated template line 10]: syntax error: (secure mode) 'array_key_exists' not allowed in if statement (Smarty_Compiler.class.php, line 1398) in unknown on line unknown
Exception trace | ||
# | Function | Location |
0 | CRM_Core_Smarty->handleSmartyError() | unknown:unknown |
1 | trigger_error() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:1215 |
2 | Smarty->trigger_error() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:2014 |
3 | Smarty->_trigger_fatal_error() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty_Compiler.class.php:2255 |
4 | Smarty_Compiler->_syntax_error() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty_Compiler.class.php:1398 |
5 | Smarty_Compiler->_compile_if_tag() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty_Compiler.class.php:467 |
6 | Smarty_Compiler->_compile_tag() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty_Compiler.class.php:306 |
7 | Smarty_Compiler->_compile_file() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:1653 |
8 | Smarty->_compile_source() | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/plugins/function.eval.php:33 |
9 | smarty_function_eval() | /home/runner/drupal/web/sites/simpletest/72001931/private/civicrm/templates_c/en_US/%%CC/CCD/CCD559CC%%string%3A%7Beval+var%3D%24smartySingleUseString%7Csmarty%3Anodefaults%7D.php:5 |
10 | include('/home/runner/dru…') | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:1405 |
11 | Smarty->fetch() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Utils/String.php:1057 |
12 | CRM_Utils_String::parseOneOffStringThroughSmarty() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/Smarty/plugins/function.help.php:97 |
13 | smarty_function_help() | /home/runner/drupal/web/sites/simpletest/72001931/private/civicrm/templates_c/en_US/%%38/384/38415E64%%RecurringEntity.tpl.php:14 |
14 | include('/home/runner/dru…') | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:2068 |
15 | Smarty->_smarty_include() | /home/runner/drupal/web/sites/simpletest/72001931/private/civicrm/templates_c/en_US/%%6B/6B0/6B0E9FC3%%Activity.tpl.php:253 |
16 | include('/home/runner/dru…') | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:2068 |
17 | Smarty->_smarty_include() | /home/runner/drupal/web/sites/simpletest/72001931/private/civicrm/templates_c/en_US/%%0C/0CB/0CBEC124%%default.tpl.php:19 |
18 | include('/home/runner/dru…') | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:2068 |
19 | Smarty->_smarty_include() | /home/runner/drupal/web/sites/simpletest/72001931/private/civicrm/templates_c/en_US/%%F7/F77/F77C7890%%CMSPrint.tpl.php:61 |
20 | include('/home/runner/dru…') | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:2068 |
21 | Smarty->_smarty_include() | /home/runner/drupal/web/sites/simpletest/72001931/private/civicrm/templates_c/en_US/%%2B/2BD/2BD99720%%drupal8.tpl.php:6 |
22 | include('/home/runner/dru…') | /home/runner/drupal/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php:1405 |
23 | Smarty->fetch() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Display.php:117 |
24 | CRM_Core_QuickForm_Action_Display->renderForm() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Display.php:83 |
25 | CRM_Core_QuickForm_Action_Display->perform() | /home/runner/drupal/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php:203 |
26 | HTML_QuickForm_Controller->handle() | /home/runner/drupal/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php:103 |
27 | HTML_QuickForm_Page->handle() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/Controller.php:355 |
28 | CRM_Core_Controller->run() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Utils/Wrapper.php:98 |
29 | CRM_Utils_Wrapper->run() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:298 |
30 | CRM_Core_Invoke::runItem() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:69 |
31 | CRM_Core_Invoke::_invoke() | /home/runner/drupal/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:36 |
32 | CRM_Core_Invoke::invoke() | /home/runner/drupal/web/modules/contrib/civicrm/src/Civicrm.php:88 |
33 | Drupal\civicrm\Civicrm->invoke() | /home/runner/drupal/web/modules/contrib/civicrm/src/Controller/CivicrmController.php:83 |
34 | Drupal\civicrm\Controller\CivicrmController->main() | unknown:unknown |
35 | call_user_func_array() | /home/runner/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123 |
36 | Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() | /home/runner/drupal/web/core/lib/Drupal/Core/Render/Renderer.php:592 |
37 | Drupal\Core\Render\Renderer->executeInRenderContext() | /home/runner/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:124 |
38 | Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() | /home/runner/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:97 |
39 | Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() | /home/runner/drupal/vendor/symfony/http-kernel/HttpKernel.php:181 |
40 | Symfony\Component\HttpKernel\HttpKernel->handleRaw() | /home/runner/drupal/vendor/symfony/http-kernel/HttpKernel.php:76 |
41 | Symfony\Component\HttpKernel\HttpKernel->handle() | /home/runner/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php:58 |
42 | Drupal\Core\StackMiddleware\Session->handle() | /home/runner/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php:48 |
43 | Drupal\Core\StackMiddleware\KernelPreHandle->handle() | /home/runner/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php:106 |
44 | Drupal\page_cache\StackMiddleware\PageCache->pass() | /home/runner/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php:85 |
45 | Drupal\page_cache\StackMiddleware\PageCache->handle() | /home/runner/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php:48 |
46 | Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() | /home/runner/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php:51 |
47 | Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() | /home/runner/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php:51 |
48 | Drupal\Core\StackMiddleware\StackedHttpKernel->handle() | /home/runner/drupal/web/core/lib/Drupal/Core/DrupalKernel.php:704 |
49 | Drupal\Core\DrupalKernel->handle() | /home/runner/drupal/web/index.php:19 |