Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Illuminate/Http/Client/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ public function send(): array
]))->promise()->wait();
}

// Before returning the results, we must ensure that the results are sorted
// in the same order as the requests were defined, respecting any custom
// key names that were assigned to this request using the "as" method.
uksort($results, function ($key1, $key2) {
return array_search($key1, array_keys($this->requests), true) <=>
array_search($key2, array_keys($this->requests), true);
});

if (! $this->hasFailures() && $this->thenCallback !== null) {
call_user_func($this->thenCallback, $this, $results);
}
Expand Down