Fix mb_strlen() TypeError when handling array values in POST data #97
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
TypeErrorthat occurs during file upload when the uploader encounters array values in POST data from multi-select form fields.Issue
The error
mb_strlen(): Argument #1 ($string) must be of type string, array givenwas being thrown at line 211 inuploader_iw_upload_handler.php. This happened when metadata fields contained array values (e.g., from checkboxes or multi-select inputs) instead of simple strings.Solution
Added proper type checking to handle both string and array values gracefully:
Changes
implode()andarray_filter()Benefits
Files are now uploaded successfully without the "unknown error" message, while still properly handling metadata from various form field types.
Fixes #96.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.