Closed gsteel closed 7 years ago
Hey,
Not sure to understand clearly the issue you're trying to solve. In the case we had an experiment cookie, and the associated experiment becomes completed, the current code performs a request with a non-existing ref. It results in a 404. Ok, but what I don't get is the current code already checks if the ref is valid here: https://github.com/prismicio/php-kit/blob/master/src/Prismic/Api.php#L429
Could you show me what I'm missing?
The problem, is that if the check for the experiment returns null, which it does if the experiment has ended, then the ref is returned as whatever the cookie value is - in the case of an ended experiment, that cookie value is junk and the API responds appropriately further down the line.
Ok I see! Thanks.
It works fine! Good job.
The experiment cookie value was previously being returned unmodified if found, therefore, users with an experiment cookie for a completed experiment would cause the library to request a ref that did not exist in the API. That was a bad thing.