Skip to content

Api.php: getMauticVersion() always returns null due to header key is lower-case #233

@HerbergSystems

Description

@HerbergSystems

In Method getMauticVersion():

public function getMauticVersion()`
     {
       $headers = $this->auth->getResponseHeaders();

       if (isset($headers['Mautic-Version'])) {
           return $headers['Mautic-Version'];
       }

       return null;
   }

Unfortunately, the header (at least on our Mautic installation on Debian Buster) is all lower-case: "mautic-version", not "Mautic-Version". So, this method will always return null.

Solution:

Avoid case-sensitive checks on headers here. Simple workaround (could be done better...):

public function getMauticVersion()
   {
       $headers = $this->auth->getResponseHeaders();

       if (isset($headers['Mautic-Version'])) {
           return $headers['Mautic-Version'];
       }
       if (isset($headers['mautic-version'])) {
           return $headers['mautic-version'];
       }

       return null;
   }

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions