Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined array key "request" #180

Closed
danepowell opened this issue Jun 8, 2023 · 7 comments
Closed

Undefined array key "request" #180

danepowell opened this issue Jun 8, 2023 · 7 comments

Comments

@danepowell
Copy link

danepowell commented Jun 8, 2023

Our project recently upgraded from guzzle-cache-middleware 4.0.2 to 4.1.1 and from guzzlehttp/promises 1.5.2 to 2.0.0 as part of the same release. Immediately we started getting reports from users of this error:

Undefined array key "request"
https://github.com/Kevinrob/guzzle-cache-middleware/blob/0e12dccf3c811a18bb2f6c93882c5b5727e1b859/src/CacheEntry.php#LL275C5-L275C5

I haven't personally been able to recreate this. I'm not sure what conditions are necessary to trigger it.

Since guzzlehttp/promises has breaking changes and this library was only just updated to support it, I have to suspect this is causal.

@TheLevti
Copy link

Having the same issue. Its not the first time that this package introduces breaking changes on minor/patch versions.

Problem is that you have cached an older serialized version of this class and now when you are deserializing, you can not instantiate the object anymore. This is a very bad approach. Either it should have been a documented breaking change with provided migration guide or make sure that the cache key is prefixed with a vendor's version so that such breaking cache structure changes will result in a cache miss without crashing the app.

@TheLevti
Copy link

@e-zannelli it seems like your change causes this issue. Can you maybe add proper validation that checks if the request index exists? Or do you have a better proposal how to resolve this?

@TheLevti
Copy link

As this already happened in the past, I have written a cache wrapper that adds a prefix to each key, this time I just had to change the prefix from v2 to v3.

@Kevinrob please try to avoid introducing breaking changes on minor/patch versions as it basically breaks the app for all of your package users.

@e-zannelli
Copy link
Contributor

@danepowell Would you be able to confirm the fix in #181 fix your issue? Thanks

@Kevinrob
Copy link
Owner

ho! I'm very sorry, I don't catch the fact that this will be a breaking change!

@danepowell
Copy link
Author

I'm not 100% confident in my ability to reproduce this error, but yes, in my limited testing the 4.1.2 release fixes this. Thanks!

@Kevinrob
Copy link
Owner

Thank you @danepowell for the follow up.
Sorry again for the breaking-change-release, this was not intentional.

I close this issue, don't hesitate to reopen it if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants