@@ -396,7 +396,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
396396 $ info ['peer_certificate_chain ' ] = array_map ('openssl_x509_read ' , array_column ($ certinfo , 'Cert ' ));
397397 }
398398
399- if (300 <= $ info ['http_code ' ] && $ info ['http_code ' ] < 400 ) {
399+ if (300 <= $ info ['http_code ' ] && $ info ['http_code ' ] < 400 && null !== $ options ) {
400400 if (curl_getinfo ($ ch , \CURLINFO_REDIRECT_COUNT ) === $ options ['max_redirects ' ]) {
401401 curl_setopt ($ ch , \CURLOPT_FOLLOWLOCATION , false );
402402 } elseif (303 === $ info ['http_code ' ] || ('POST ' === $ info ['http_method ' ] && \in_array ($ info ['http_code ' ], [301 , 302 ], true ))) {
@@ -418,7 +418,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
418418
419419 $ info ['redirect_url ' ] = null ;
420420
421- if (300 <= $ statusCode && $ statusCode < 400 && null !== $ location ) {
421+ if (300 <= $ statusCode && $ statusCode < 400 && null !== $ location && null !== $ options ) {
422422 if ($ noContent = 303 === $ statusCode || ('POST ' === $ info ['http_method ' ] && \in_array ($ statusCode , [301 , 302 ], true ))) {
423423 $ info ['http_method ' ] = 'HEAD ' === $ info ['http_method ' ] ? 'HEAD ' : 'GET ' ;
424424 curl_setopt ($ ch , \CURLOPT_CUSTOMREQUEST , $ info ['http_method ' ]);
@@ -433,7 +433,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
433433
434434 if (401 === $ statusCode && isset ($ options ['auth_ntlm ' ]) && 0 === strncasecmp ($ headers ['www-authenticate ' ][0 ] ?? '' , 'NTLM ' , 5 )) {
435435 // Continue with NTLM auth
436- } elseif ($ statusCode < 300 || 400 <= $ statusCode || null === $ location || curl_getinfo ($ ch , \CURLINFO_REDIRECT_COUNT ) === $ options ['max_redirects ' ]) {
436+ } elseif ($ statusCode < 300 || 400 <= $ statusCode || null === $ location || null === $ options || curl_getinfo ($ ch , \CURLINFO_REDIRECT_COUNT ) === $ options ['max_redirects ' ]) {
437437 // Headers and redirects completed, time to get the response's content
438438 $ multi ->handlesActivity [$ id ][] = new FirstChunk ();
439439
0 commit comments