Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9372

Don't rely on Smarty singleton to pass data

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 3.4.8, 4.0.8
    • Fix Version/s: Unscheduled
    • Component/s: Core CiviCRM
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      I've noticed many bugs have been hidden by the fact that Smarty templates are a singleton. To illustrate, CRM_Event_BAO_Event::sendMail is supposed to get its variables from a function argument. Code in that function is testing data coming in through that argument, yet the data is not passed through to sendMessageTemplate. Instead, code like CRM/Event/Form/Registration/Register.php :: processRegistration is calling assign(), and the data is only appearing in the generated emails thanks to the singleton template object.

      This is very unclear for the programmer, and also a fragile practice since the data in the singleton object would be overwritten if another message was sent (or a form rendered) after the first assign() call.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              adamw Adam Wight
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: