ActiveCampaign / activecampaign-api-php

MIT License
115 stars 76 forks source link

Changing versions breaks url_base property in ActiveCampaign class #119

Open RonanBitpuma opened 3 years ago

RonanBitpuma commented 3 years ago

The piece of code causing the issue: https://github.com/ActiveCampaign/activecampaign-api-php/blob/2bf5b72ba8668de8dcb27e194948028276e748c5/includes/ActiveCampaign.class.php#L78-L83

This is what I do: image

What I did to reproduce the bug

  1. I get the contact list
  2. This does not work, which is correct, as I haven't set the version
  3. I set the version to 2
  4. I get the contact list
  5. This works, as intended.
  6. I set the version back to 1, this is where the $url_base property 'breaks'
  7. I get the contact list
  8. This does not work, which is correct, as the version is back to 1
  9. I set the version back to 2
  10. I get the contact list
  11. This does not work, while it should. $ac->url_base now returns api_url.com/2/2 (Note the double /2!)

Because of this bug it requires me to create new instances of the ActiveCampaign class, instead of using one single instance