Skip to content

There is no warning about the ext-gmp requirement except a big crash #85

@VincentLanglet

Description

@VincentLanglet

Hi @matthewelwell,

We encounter a huge production incident because we recently created an A/B test flag (without using it so far) because we didn't have the ext-gmp extension.

This because of the code

public function getValue($identityId = null)
{
if ($identityId && count($this->multivariate_feature_state_values) > 0) {
return $this->getMultivariateValue($identityId);
}
return $this->_value;

which, in case we enter in the if part
ends up using
public function getHashedPercentageForObjectIds(array $objectIds, int $iterations = 1)

which use gmp_init and gmp_strval (it also use bc_ methods).

I dunno if I should add them to the composer.json, because they are only needed if (and when) you are using the A/B testing flags.

  • Adding them would avoid people having crash when using the A/B testing flags without the php extension
  • But adding them would blocks people who use the lib without using the multivariate_feature_state_values feature if they don't have the extensions.

The other option would be for the lib to somehow skip such flags when the lib are not available and add a deprecation/php warning in logs...

I feel like updating the composer.json is simpler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions