Call to SmartyCompilerException fails in <drupal root>/vendor/civicrm/civicrm-packages/smarty3/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on template compiler error.
Overview
When <drupal root>/vendor/civicrm/civicrm-packages/smarty3/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
fails to compile a template, it attempts to create a SmartyCompilerException
by calling this code:
$e = new SmartyCompilerException($error_text);
$e->line = $line;
$e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ]));
$e->desc = $args;
$e->template = $this->template->source->filepath;
throw $e;
It crashes on the first line giving this message instead.
PHP Fatal error: Type of SmartyCompilerException::$line must be int (as in class Exception) in D:\CiviCRM_Custom.git\drupal_test\vendor\civicrm\civicrm-packages\smarty3\vendor\smarty\smarty\libs\sysplugins\smartycompilerexception.php on line 8
Reproduction steps
- Attempt to register for an event on line.
- Enter details.
- Click Review.
- Click Register.
Current behaviour
With the current (5.70.1) Events - Registration Confirmation and Receipt (on-line)
template, you get the above error.
|----------------------------------------------------------
Expected behaviour
You get a successful registration.
Environment information
- Browser: MS Edge but probably irrelevant
- CiviCRM: 5.70.1
- PHP: 8.3.1_
- CMS: Drupal 10.2.3
- Database: MySQL 8.0.
- Web Server: IIS
Comments
The fatal error occurs in the first line of the code snippet (line 1153) before the line number is entered. I have been unable to determine which Exception is being extended. This will, of course, only be an issue if there is a problem compiling a template.