@@ -79,7 +79,7 @@ public function __construct(
7979 };
8080
8181 $ 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 ]) {
8383 unset($ multi ->hosts [$ host ]);
8484 }
8585 unset($ multi ->openHandles [$ id ], $ multi ->handlesActivity [$ id ]);
@@ -123,7 +123,7 @@ private function open(): void
123123 throw new TransportException ($ msg );
124124 }
125125
126- $ this ->logger ?->info(sprintf ('%s for "%s". ' , $ msg , $ url ?? $ this ->url ));
126+ $ this ->logger ?->info(\ sprintf ('%s for "%s". ' , $ msg , $ url ?? $ this ->url ));
127127 });
128128
129129 try {
@@ -142,7 +142,7 @@ private function open(): void
142142 $ this ->info ['request_header ' ] = $ this ->info ['url ' ]['path ' ].$ this ->info ['url ' ]['query ' ];
143143 }
144144
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 ' ]);
146146 $ this ->info ['request_header ' ] .= implode ("\r\n" , $ context ['http ' ]['header ' ])."\r\n\r\n" ;
147147
148148 if (\array_key_exists ('peer_name ' , $ context ['ssl ' ]) && null === $ context ['ssl ' ]['peer_name ' ]) {
@@ -159,7 +159,7 @@ private function open(): void
159159 break ;
160160 }
161161
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 ));
163163 }
164164 } catch (\Throwable $ e ) {
165165 $ this ->close ();
@@ -294,15 +294,15 @@ private static function perform(ClientState $multi, ?array &$responses = null):
294294
295295 if (null === $ e ) {
296296 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 ));
298298 } elseif (-1 === $ remaining && fwrite ($ buffer , '- ' ) && '' !== stream_get_contents ($ buffer , -1 , 0 )) {
299299 $ e = new TransportException ('Transfer closed with outstanding data remaining from chunked response. ' );
300300 }
301301 }
302302
303303 $ multi ->handlesActivity [$ i ][] = null ;
304304 $ 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 ]) {
306306 unset($ multi ->hosts [$ host ]);
307307 }
308308 unset($ multi ->openHandles [$ i ]);
0 commit comments