[regression] MembershipManager::getMembership since 1.0.0-alpha11

Created on 16 May 2025, 23 days ago

Problem/Motivation

It seems an issue was introduced in 1.0.0-alpha11 from https://git.drupalcode.org/project/og/-/commit/7e069fd8d79e665ce6424c01f...
This also applies to 2.x.

The changes do not take into account the fact that the OG group may be new and does not have an ID yet.
I have yet to understand why this is called on a new group (without ID) in the case I'm encountering but I assume an early return in such cases would not hurt.

This causes warning errors such as

Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1392 of /var/www/html/web/core/lib/Drupal/Core/Database/Connection.php)

Stacktrace:

Connection.php:1392, Drupal\Core\Database\Connection->escapeLike()
Select.php:431, Drupal\Core\Database\Query\Select->escapeLike()
Condition.php:125, Drupal\Core\Entity\Query\Sql\Condition::translateCondition()
Condition.php:70, Drupal\Core\Entity\Query\Sql\Condition->compile()
Query.php:177, Drupal\Core\Entity\Query\Sql\Query->compile()
Query.php:82, Drupal\Core\Entity\Query\Sql\Query->execute()
MembershipManager.php:134, Drupal\og\MembershipManager->getMembership()
...

Steps to reproduce

Call MembershipManager::getMembership with a new/unsaved OG group as first parameter.

Proposed resolution

Possibly add an early return NULL?

Remaining tasks

todo

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

1.0

Component

og.module

Created by

🇧🇪Belgium herved

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