Browse Source

When parsing response with regex, check resulting array of matches better to avoid undefined index notices

pull/12/head
Jesse Ross 7 years ago
parent
commit
62b3590951
  1. 4
      src/Client.php

4
src/Client.php

@ -240,7 +240,7 @@ class Client implements Interfaces\ClientInterface
// If we have lines after current one
if (isset($response[$j])) {
$this->pregResponse($response[$j], $matches);
if (!empty($matches)) {
if (isset($matches[1][0]) && isset($matches[2][0])) {
$result['after'][$matches[1][0]] = $matches[2][0];
}
}
@ -248,7 +248,7 @@ class Client implements Interfaces\ClientInterface
break 2;
default:
$this->pregResponse($value, $matches);
if (!empty($matches)) {
if (isset($matches[1][0]) && isset($matches[2][0])) {
$result[$i][$matches[1][0]] = $matches[2][0];
}
break;

Loading…
Cancel
Save