-
Notifications
You must be signed in to change notification settings - Fork 9.4k
WEBAPI: PHP session is always started 2.1.2 #7213
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
Comments
@boldhedgehog, thank you for your report. |
Hi @boldhedgehog. Thank you for your report. The fix will be available with the upcoming patch release. |
Dear @magento-team, you have merged something wrong because this fix is in 2.2 but in 2.3 and later is not. |
I re-opened this task. Issue was fixed in 2.2.x, but not in 2.3.x and 2.4.x release lines. #26032 fixes this issue |
Hi @engcom-Delta. Thank you for working on this issue.
|
✅ Confirmed by @engcom-Delta Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
…6032 - Merge Pull Request #26032 from maqlec/magento2:issue-7213 - Merged commits: 1. 859307b 2. 8aed39f 3. 4a05e78 4. cfa889e 5. b219c4e 6. c5ad40b 7. fe0bd17 8. ac0dea5 9. ea10595 10. b4a02dd 11. 4f20656 12. 192bc7e 13. f149763 14. ac0f4e6 15. 3e833b3 16. c1f5509 17. edd0ccd 18. 4dac67d 19. 97b235d 20. 16797c3
[Platform Health] Updates for PHP8.1
Although REST API should be stateless for anonymous calls, PHP session is always created. This is caused by the fact that session_start() is called implicitly from '\Magento\Framework\Session\SessionManager' constructor.
There are 2 issues with this: Spammed PHP session which will never be used, if remote address validation is enabled for sessions, clients with dynamic IP address will get 302 redirect instead of REST API result, and this is undesirable.
Preconditions
Steps to reproduce
Expected result
Actual result
Why?
The reason for this is that in di.xml
\Magento\Authorization\Model\CompositeUserContext
is fed withuserContexts
argument, and at least 2 of them will start PHP session:customerSessionUserContext
andadminSessionUserContext
.How to fix
My PoC solution was to modify
vendor/magento/module-customer/etc/webapi_rest/di.xml
andvendor/magento/module-user/etc/webapi_rest/di.xml
so that types foruserContext
would be Proxies, and they would be created on-demand.I do not know which one of the changes fixed the issue, but I achieved the expected result.
The text was updated successfully, but these errors were encountered: