Fix Bug In How getEnrolledFactors Handles the otp_devices API Data#28
Merged
Subterrane merged 3 commits intomasterfrom Sep 15, 2025
Merged
Fix Bug In How getEnrolledFactors Handles the otp_devices API Data#28Subterrane merged 3 commits intomasterfrom
Subterrane merged 3 commits intomasterfrom
Conversation
…patibility Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Bug In How getEnrolledFactors Handles the otp_devices API Data
Fix Bug In How getEnrolledFactors Handles the otp_devices API Data
Sep 15, 2025
Contributor
|
Consider these suggestions:
// Should be: Also
|
Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
Contributor
Author
Fixed all three issues in commit c48c6ae:
The solution preserves backward compatibility while correctly handling the otp_devices API format. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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.
This PR fixes a critical bug in the OneLogin PHP SDK where
getEnrolledFactorsandgetFactorsmethods fail due to an API inconsistency in how the otp_devices endpoint returns data.Problem
The otp_devices API endpoint returns data wrapped in an object format
{otp_devices: [...]}instead of a flat array like other endpoints. This causes two critical failures:count(): Argument #1 ($value) must be of type Countable|array, stdClass giveninhandleDataResponsemethodempty($data[0])always evaluates to true for objects, causing the method to return empty arrays even when data existsOTPDeviceandAuthFactorconstructors throw exceptions when optional API fields are missingSolution
1. Fixed
handleDataResponsemethod inOneLoginClient.php2. Fixed model constructors with proper type handling
Impact
getEnrolledFactorsnow correctly processes otp_devices API responsesgetFactorsbenefits from the same robustness improvementsTesting
Comprehensive testing validates:
falseinstead of empty stringsnullfor better error detectionFixes #12.
Warning
https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba/usr/bin/php8.3 -n -c /tmp/nOwkcr /usr/bin/composer install(http block)https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3/usr/bin/php8.3 -n -c /tmp/nOwkcr /usr/bin/composer install(http block)💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.