1

I am having trouble with event registrations on an event that seemed to work fine a couple of months ago. The live event happened with no issues back in Jan and Feb. We've since re-activated the event as a gateway to access the videos. We changed the dates to keep it available and started taking registrations. I can't recall if we tested it then again or not. However, it is now crashing with "There has been a critical error on this website"

The financial transaction is taking place, but no email is being sent or any other positive indication.

The CiviCRM log is not very interesting and does nothing in response to the event. I guess it's failing before it even gets back there.

The Apache log shows this:

[Mon May 06 21:38:23.158374 2024] [proxy_fcgi:error] [pid 1683822:tid 140013131994816] [client 174.89.140.61:58238] AH01071: Got error 'PHP message: PHP Warning: Undefined array key "selfcancelxfer_time" in /var/www/civicrmsite/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/BAO/Event.php on line 1172; PHP message: PHP Warning: Undefined array key "selfcancelxfer_time" in /var/www/civicrmsite/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/BAO/Event.php on line 1173; PHP message: PHP Parse error: syntax error, unexpected token ">" in /var/www/civicrmsite/wordpress/wp-content/plugins/civicrm/civicrm/packages/Smarty/Smarty.class.php(2018) : eval()'d code on line 624', referer: https://civicrmsite/civicrm/event/register/?_qf_Confirm_display=true&qfKey=CRMEventControllerRegistration4xuwhov9accg4kgs40cswkwo4wksk4kg44w8o0wsoswg4gog8s_7359

I've reset all the system messages back to the defaults. The only one customized was the basic "Invoice" one anyway. Same error. I am also confused by the (2018) in brackets on /var/www/civicrmsite/wordpress/wp-content/plugins/civicrm/civicrm/packages/Smarty/Smarty.class.php(2018) There is no such file. If remove (2018) and then visit the line 624 reference I'm no wiser with a very simple if test inside a foreach loop:

    function append($tpl_var, $value=null, $merge=false)
    {
        if (is_array($tpl_var)) {
            // $tpl_var is an array, ignore $value
            foreach ($tpl_var as $_key => $_val) {
                if ($_key != '') {          # this is line 624

presumably the "unexpected token ">"' mentioned in the Apache error log is coming through somewhere, but I haven't a clue where.

I'm on CiviCRM 5.70.1 on WordPress 6.5.2 and PHP 8.2.13. I have kept the system on Smarty 2 for now. Could that have something to do with it? I can start to move the upgrades along, but I'd prefer to fix the problem first unless someone tells me it's a known problem that is fixed in a newer version.

Anyone have any thoughts? Further diagnostics I could perform?

2
  • These are hard to find. The 2018 means line 2018, but all that tells you is it's an error. You said you reset the message templates, but the line 624 refers to line 624 in the compiled version of the message template. And if I had to guess it's referring to the ending > meaning it thinks the compiled template has an open control structure that hasn't been closed (e.g. an if or foreach or something). Ideally you'd be able to add some logging just before it throws the error, but I'm not sure where that is.
    – Demerit
    Commented May 6 at 23:22
  • 1
    Might be worth checking out below post as could be the same error civicrm.stackexchange.com/questions/47973/… Commented May 7 at 7:50

1 Answer 1

2

If you are on CiviCRM 5.70.x then it's a known issue which is fixed in the recent version. You can either apply the below patch and do db changes or upgrade CiviCRM to 5.72.x

  1. Patch file CRM/Event/DAO/Event.php
diff --git a/CRM/Event/DAO/Event.php b/CRM/Event/DAO/Event.php
index 32de78e3325c..de7379737b04 100644
--- a/CRM/Event/DAO/Event.php
+++ b/CRM/Event/DAO/Event.php
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Event.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d63c53d10f2e09895a19061ea9d51093)
+ * (GenCodeChecksum:193894c0362eb3c7360ad8245e303fcf)
  */
 
 /**
@@ -542,7 +542,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * Number of hours prior to event start date to allow self-service cancellation or transfer.
    *
-   * @var int|string|null
+   * @var int|string
    *   (SQL type: int)
    *   Note that values will be retrieved from the database as a string.
    */
@@ -1994,6 +1994,7 @@ public static function &fields() {
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Self-service Cancellation or Transfer Time'),
           'description' => ts('Number of hours prior to event start date to allow self-service cancellation or transfer.'),
+          'required' => TRUE,
           'usage' => [
             'import' => FALSE,
             'export' => FALSE,
  1. Run below query
UPDATE civicrm_event SET selfcancelxfer_time = 0 WHERE selfcancelxfer_time IS NULL;

ALTER TABLE civicrm_event MODIFY COLUMN selfcancelxfer_time int(11) DEFAULT 0 NOT NULL COMMENT 'Number of hours prior to event start date to allow self-service cancellation or transfer.';


  1. Clear CiviCRM cache

HTH

Pradeep

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.