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

Fix: restore array parameter support in CatalogItemsV20220401Api #832

Closed

Conversation

burakaktna
Copy link

Description

This PR fixes the breaking change introduced in v5.10.3 (PR #700) that affected parameter type handling in searchCatalogItemsRequest. The fix restores support for both string and array inputs while maintaining the validation logic.

Change Details

  • Added getArraySize helper method to handle both array and string inputs consistently
  • Fixed parameter validation to support both input types
  • Maintained existing query parameter handling logic
  • Restored backwards compatibility without breaking changes

Related Issue

Fixes #831

Background

PR #700 introduced stricter type checking that unintentionally broke backwards compatibility by enforcing string-only parameters. This change restores the ability to handle both string and array inputs while maintaining the same validation rules.

Testing

  • Supports both string and comma-separated inputs
  • Maintains array handling in query parameters
  • Preserves validation limits (1 for marketplace_ids, 20 for others)
  • Backwards compatible with existing implementations

The changes resolve the TypeError: explode(): Argument #2 ($string) must be of type string, array given

quazardous and others added 15 commits September 21, 2023 19:01
Update v5.0 branch to before v6 changes
Simplify logging of exceptions, requests and responses.
keywords, identifiers, and marketplace_ids can each be comma-separated strings that have a limit on
values. The code was trying to use count() to check for that, which doesn't work. I added explode(",", $var)
to fix this.

Imo, it would make more sense if these parameters were typed as arrays to begin with, but making a change like
that would break existing implementations. This method was chosen so it will "just work" for anyone's existing
usage of the library.
Fix incorrect parameter checks inside searchCatalogItemsRequest
- Add getArraySize helper method for consistent counting
- Maintain array handling in query parameters
- Fix backwards compatibility from PR jlevers#700

Fixes jlevers#831
@burakaktna burakaktna closed this Dec 17, 2024
@burakaktna burakaktna deleted the fix/explode-parameter-support branch December 17, 2024 10:41
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

Successfully merging this pull request may close these issues.

Fix: explode() parameter type compatibility issue in CatalogItemsV20220401Api
6 participants