populateAcquiaSettings() method wrong condition

Created on 30 December 2022, about 2 years ago
Updated 18 January 2023, about 2 years ago

Problem/Motivation

There is a method populateAcquiaSettings() of a class AcquiaSubsription to which we come from acquia_search_init() function. This method populates the settings from various sources. If the variable table is already populated, it uses those credentials instead of Acquia cloud. If local credentials don't exist, it attempts to set with Acquia cloud:

  public function populateAcquiaSettings() {
    // Attempt to set local credentials first.
    $this->setLocalCredentials();

    // If local credentials don't exist, attempt to set with Acquia cloud.
    if (!$this->settings) {
      $this->setAcquiaCloudCredentials();
    }
  }

The problem is that setLocalCredentials() method, which runs first, always fills $this->settings property. In case local credentials are not set, $this->settings will contain AcquiaSettings object instance with empty properties:

    if (!$identifier || !$key || !$application_uuid) {
      $this->settings = new AcquiaSettings();
      return;
    }

Due to this fact the if (!$this->settings) condition will not work and setAcquiaCloudCredentials() method will never run.

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇧🇾Belarus yurikulinkovich

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024