File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ protected function request(
136
136
* @param array<string> $headers
137
137
* @param array<array<string, mixed>> $bodies
138
138
* @return array<array{
139
+ * index: int,
139
140
* url: string,
140
141
* statusCode: int,
141
142
* response: array<string, mixed>|null,
@@ -209,6 +210,7 @@ protected function requestMulti(
209
210
\curl_setopt ($ ch , CURLOPT_URL , $ urls [$ i ]);
210
211
\curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ bodies [$ i ]);
211
212
\curl_setopt ($ ch , CURLOPT_HTTPHEADER , $ headers );
213
+ \curl_setopt ($ ch , CURLOPT_PRIVATE , $ i );
212
214
\curl_multi_add_handle ($ mh , \curl_copy_handle ($ ch ));
213
215
}
214
216
@@ -236,6 +238,7 @@ protected function requestMulti(
236
238
}
237
239
238
240
$ responses [] = [
241
+ 'index ' => (int )\curl_getinfo ($ ch , CURLINFO_PRIVATE ),
239
242
'url ' => \curl_getinfo ($ ch , CURLINFO_EFFECTIVE_URL ),
240
243
'statusCode ' => \curl_getinfo ($ ch , CURLINFO_RESPONSE_CODE ),
241
244
'response ' => $ response ,
Original file line number Diff line number Diff line change @@ -139,18 +139,18 @@ protected function process(PushMessage $message): array
139
139
140
140
$ response = new Response ($ this ->getType ());
141
141
142
- foreach ($ results as $ index => $ result ) {
142
+ foreach ($ results as $ result ) {
143
143
if ($ result ['statusCode ' ] === 200 ) {
144
144
$ response ->incrementDeliveredTo ();
145
- $ response ->addResult ($ message ->getTo ()[$ index ]);
145
+ $ response ->addResult ($ message ->getTo ()[$ result [ ' index ' ] ]);
146
146
} else {
147
147
$ error =
148
148
($ result ['response ' ]['error ' ]['status ' ] ?? null ) === 'UNREGISTERED '
149
149
|| ($ result ['response ' ]['error ' ]['status ' ] ?? null ) === 'NOT_FOUND '
150
150
? $ this ->getExpiredErrorMessage ()
151
151
: $ result ['response ' ]['error ' ]['message ' ] ?? 'Unknown error ' ;
152
152
153
- $ response ->addResult ($ message ->getTo ()[$ index ], $ error );
153
+ $ response ->addResult ($ message ->getTo ()[$ result [ ' index ' ] ], $ error );
154
154
}
155
155
}
156
156
You can’t perform that action at this time.
0 commit comments