Call to a member function getId() on null in pet_substitutions()

Created on 2 April 2024, about 1 year ago
Updated 3 April 2024, about 1 year ago

Problem/Motivation

Similar to the linked issue, pet_substitutions fails in pet_substitutions if the language code has not been provided -- despite being an optional parameter. The linked issue (now closed and marked as fixed) does not fix the issue.

Steps to reproduce

Call pet_send_one_mail with a pet email and params like the following:

$pet_email = get_pet_email_somehow();

$params = [
        'pet_from' => 'email@email.com',
        'pet_to' => 'email@email.com',
        'pet_nid' => 'id',
        'pet_uid' => 'uid'
      ];

pet_send_one_mail($pet_email, $params);

This will fail with a message like so:

Error: Call to a member function getId() on null in pet_substitutions() (line 311 of /app/web/modules/contrib/pet/pet.module).

Proposed resolution

Ensure the language parameter is provided pet_substitutions is called.

🐛 Bug report
Status

Needs review

Version

4.3

Component

Code

Created by

🇬🇧United Kingdom cwales95

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024