@@ -408,7 +408,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
408408 $ info ['peer_certificate_chain ' ] = array_map ('openssl_x509_read ' , array_column ($ certinfo , 'Cert ' ));
409409 }
410410
411- if (300 <= $ info ['http_code ' ] && $ info ['http_code ' ] < 400 ) {
411+ if (300 <= $ info ['http_code ' ] && $ info ['http_code ' ] < 400 && null !== $ options ) {
412412 if (curl_getinfo ($ ch , \CURLINFO_REDIRECT_COUNT ) === $ options ['max_redirects ' ]) {
413413 curl_setopt ($ ch , \CURLOPT_FOLLOWLOCATION , false );
414414 } elseif (303 === $ info ['http_code ' ] || ('POST ' === $ info ['http_method ' ] && \in_array ($ info ['http_code ' ], [301 , 302 ], true ))) {
@@ -430,7 +430,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
430430
431431 $ info ['redirect_url ' ] = null ;
432432
433- if (300 <= $ statusCode && $ statusCode < 400 && null !== $ location ) {
433+ if (300 <= $ statusCode && $ statusCode < 400 && null !== $ location && null !== $ options ) {
434434 if ($ noContent = 303 === $ statusCode || ('POST ' === $ info ['http_method ' ] && \in_array ($ statusCode , [301 , 302 ], true ))) {
435435 $ info ['http_method ' ] = 'HEAD ' === $ info ['http_method ' ] ? 'HEAD ' : 'GET ' ;
436436 curl_setopt ($ ch , \CURLOPT_CUSTOMREQUEST , $ info ['http_method ' ]);
@@ -445,7 +445,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
445445
446446 if (401 === $ statusCode && isset ($ options ['auth_ntlm ' ]) && 0 === strncasecmp ($ headers ['www-authenticate ' ][0 ] ?? '' , 'NTLM ' , 5 )) {
447447 // Continue with NTLM auth
448- } elseif ($ statusCode < 300 || 400 <= $ statusCode || null === $ location || curl_getinfo ($ ch , \CURLINFO_REDIRECT_COUNT ) === $ options ['max_redirects ' ]) {
448+ } elseif ($ statusCode < 300 || 400 <= $ statusCode || null === $ location || null === $ options || curl_getinfo ($ ch , \CURLINFO_REDIRECT_COUNT ) === $ options ['max_redirects ' ]) {
449449 // Headers and redirects completed, time to get the response's content
450450 $ multi ->handlesActivity [$ id ][] = new FirstChunk ();
451451
0 commit comments