Closed klokit-co closed 5 years ago
My production server is throwing the following error when attempting to create an invoice.
"Notice: Undefined offset: 2 in btcpayserver-php-client/src/BTCPayServer/Client/Response.php on line 76"
Line 76 is breaking when trying to interpret the first line of the response, which is : "0 = HTTP/2 200"
$response->setStatusCode($statusCode = $statusLine[2];
$statusLine[2] is (supposed to be being) initialised by the preceding line :
preg_match('/^HTTP\/(\d.\d)\s(\d+)\s(.+)/', $lines[$i], $statusLine);
It is that line that is trying to parse "0 = HTTP/2 200".
Obviously there's something in the format of the supplied string that is breaking the patterns being searched for in preg_match()
For now, I am using the following workaround.
if(strstr($lines[$i],'HTTP/2 200')) $lines[$i] = str_replace('HTTP/2 200','HTTP/2.1 200 OK',$lines[$i]);
Can you test https://github.com/btcpayserver/btcpayserver-php-client/pull/11 and let us know?
My production server is throwing the following error when attempting to create an invoice.
"Notice: Undefined offset: 2 in btcpayserver-php-client/src/BTCPayServer/Client/Response.php on line 76"
Line 76 is breaking when trying to interpret the first line of the response, which is : "0 = HTTP/2 200"
$response->setStatusCode($statusCode = $statusLine[2];
$statusLine[2] is (supposed to be being) initialised by the preceding line :
preg_match('/^HTTP\/(\d.\d)\s(\d+)\s(.+)/', $lines[$i], $statusLine);
It is that line that is trying to parse "0 = HTTP/2 200".
Obviously there's something in the format of the supplied string that is breaking the patterns being searched for in preg_match()
For now, I am using the following workaround.
if(strstr($lines[$i],'HTTP/2 200')) $lines[$i] = str_replace('HTTP/2 200','HTTP/2.1 200 OK',$lines[$i]);