Skip to content

Commit

Permalink
Fix parsing multidimensional array from multipart (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinimaks authored Jan 7, 2025
1 parent 7332946 commit 9dde475
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ public static function setMultipartArrayValue(array $array, string $name, $value
return $array;
}

$segment = substr($segment, 0, -1);

// If the segment is empty after trimming off the closing bracket, it means
// we are at the end of the segment and are ready to set the value so we
// can grab a pointer to the array location and set it after the loop.
if (empty($segment = substr($segment, 0, -1))) {
if ($segment === '') {
$pointer = &$pointer[];
} else {
$pointer = &$pointer[$segment];
Expand Down

0 comments on commit 9dde475

Please sign in to comment.