Fix infinite recursion in Core::call() on same-domain 302 redirect#406
Merged
Fix infinite recursion in Core::call() on same-domain 302 redirect#406
Conversation
…domain (#372) Signed-off-by: mesilov <mesilov.maxim@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
Core::call()received a302 STATUS_FOUNDresponse, it extracted onlyscheme://hostfrom the
Locationheader and recursively called itself with the new domain.On self-hosted portals with an expired license, Bitrix24 redirects every request to
/bitrix/coupon_activation.php— same host, different path. The extracted domain was identicalto the old domain,
changeDomainUrl()silently accepted it, and the method called itself forever,producing a PHP fatal stack overflow.
Fix:
After computing
portalNewDomainUrlHost, compare it toportalOldDomainUrlHost.If they are equal this is NOT a legitimate domain-migration — throw
PortalUnavailableExceptionwith the full
LocationURL in the message so callers and logs have the context they need.New exception:
Bitrix24\SDK\Core\Exceptions\PortalUnavailableException extends BaseExceptionUsage (caller side):
Test plan
make lint-cs-fixer— passedmake lint-rector— passed (auto-fix: unused catch variable removed)make lint-phpstan— passedmake lint-deptrac— passed (0 violations)make test-unit— passed (663 tests, 1138 assertions)Closes #372
🤖 Generated with Claude Code