@@ -79,7 +79,7 @@ public function __construct(
79
79
};
80
80
81
81
$ this ->canary = new Canary (static function () use ($ multi , $ id ) {
82
- if (null !== ($ host = $ multi ->openHandles [$ id ][6 ] ?? null ) && 0 >= --$ multi ->hosts [$ host ]) {
82
+ if (null !== ($ host = $ multi ->openHandles [$ id ][6 ] ?? null ) && isset ( $ multi -> hosts [ $ host ]) && 0 >= --$ multi ->hosts [$ host ]) {
83
83
unset($ multi ->hosts [$ host ]);
84
84
}
85
85
unset($ multi ->openHandles [$ id ], $ multi ->handlesActivity [$ id ]);
@@ -123,7 +123,7 @@ private function open(): void
123
123
throw new TransportException ($ msg );
124
124
}
125
125
126
- $ this ->logger ?->info(sprintf ('%s for "%s". ' , $ msg , $ url ?? $ this ->url ));
126
+ $ this ->logger ?->info(\ sprintf ('%s for "%s". ' , $ msg , $ url ?? $ this ->url ));
127
127
});
128
128
129
129
try {
@@ -142,7 +142,7 @@ private function open(): void
142
142
$ this ->info ['request_header ' ] = $ this ->info ['url ' ]['path ' ].$ this ->info ['url ' ]['query ' ];
143
143
}
144
144
145
- $ this ->info ['request_header ' ] = sprintf ("> %s %s HTTP/%s \r\n" , $ context ['http ' ]['method ' ], $ this ->info ['request_header ' ], $ context ['http ' ]['protocol_version ' ]);
145
+ $ this ->info ['request_header ' ] = \ sprintf ("> %s %s HTTP/%s \r\n" , $ context ['http ' ]['method ' ], $ this ->info ['request_header ' ], $ context ['http ' ]['protocol_version ' ]);
146
146
$ this ->info ['request_header ' ] .= implode ("\r\n" , $ context ['http ' ]['header ' ])."\r\n\r\n" ;
147
147
148
148
if (\array_key_exists ('peer_name ' , $ context ['ssl ' ]) && null === $ context ['ssl ' ]['peer_name ' ]) {
@@ -159,7 +159,7 @@ private function open(): void
159
159
break ;
160
160
}
161
161
162
- $ this ->logger ?->info(sprintf ('Redirecting: "%s %s" ' , $ this ->info ['http_code ' ], $ url ?? $ this ->url ));
162
+ $ this ->logger ?->info(\ sprintf ('Redirecting: "%s %s" ' , $ this ->info ['http_code ' ], $ url ?? $ this ->url ));
163
163
}
164
164
} catch (\Throwable $ e ) {
165
165
$ this ->close ();
@@ -294,15 +294,15 @@ private static function perform(ClientState $multi, ?array &$responses = null):
294
294
295
295
if (null === $ e ) {
296
296
if (0 < $ remaining ) {
297
- $ e = new TransportException (sprintf ('Transfer closed with %s bytes remaining to read. ' , $ remaining ));
297
+ $ e = new TransportException (\ sprintf ('Transfer closed with %s bytes remaining to read. ' , $ remaining ));
298
298
} elseif (-1 === $ remaining && fwrite ($ buffer , '- ' ) && '' !== stream_get_contents ($ buffer , -1 , 0 )) {
299
299
$ e = new TransportException ('Transfer closed with outstanding data remaining from chunked response. ' );
300
300
}
301
301
}
302
302
303
303
$ multi ->handlesActivity [$ i ][] = null ;
304
304
$ multi ->handlesActivity [$ i ][] = $ e ;
305
- if (null !== ($ host = $ multi ->openHandles [$ i ][6 ] ?? null ) && 0 >= --$ multi ->hosts [$ host ]) {
305
+ if (null !== ($ host = $ multi ->openHandles [$ i ][6 ] ?? null ) && isset ( $ multi -> hosts [ $ host ]) && 0 >= --$ multi ->hosts [$ host ]) {
306
306
unset($ multi ->hosts [$ host ]);
307
307
}
308
308
unset($ multi ->openHandles [$ i ]);
0 commit comments