stormpath-sdk-php icon indicating copy to clipboard operation
stormpath-sdk-php copied to clipboard

Options do not reset after request

Open bretterer opened this issue 9 years ago • 4 comments

During development of the Laravel Integration, I found that when running the ['expand'=>'something'] it does not clear out for the next request. This causes all sorts of errors for future requests on the same page load where the expand is not available on a different resource.

bretterer avatar Mar 07 '16 14:03 bretterer

Might be the same issue we have experienced https://github.com/stormpath/stormpath-sdk-php/issues/48 ?

dkvk avatar Mar 07 '16 15:03 dkvk

@dkvk I am not sure that it is a caching issue here. I tested with caching turned off and still had the problem. If you do have the issue, you can run a method setOptions([]) to empty out the options array after you make a request.

bretterer avatar Mar 07 '16 18:03 bretterer

I was not able to reproduce this issue again after some updates to caching, so It is possible now that these were related. I wrote some tests to make sure that the options array is cleared for each request. See commit a6f25043dd726d805ab95d0b968bb7d0ad6c7cff

bretterer avatar Jun 30 '16 16:06 bretterer

This issue is back..

I removed the test for now.

/** @test */
    public function the_options_array_is_cleared_after_each_request()
    {
        $tenant = self::$client->getDataStore()->getResource('/tenants/current', Stormpath::TENANT, ['expand'=>'applications']);


        foreach($tenant->getApplications() as $application) {
            $this->assertEmpty($application->getAccounts()->getOptions());
        }

    }

This should be looked at. The test above is passing locally but not on travis?

bretterer avatar Jan 03 '17 15:01 bretterer