Skip to content

Commit

Permalink
Avoid single-char vars due to a bug in PHP 7.1.9
Browse files Browse the repository at this point in the history
Yes, I am serious. Really. Despite that, avoiding one-char-vars increases code readability

[E_NOTICE] Undefined variable: m in /www/jaumo/vendor/amphp/artax/lib/Internal/Parser.php (Line 184)

Renaming the vars fixes the issue. Don't ask me why but we REALLY have that problem in production!
  • Loading branch information
brstgt authored and kelunik committed Oct 3, 2017
1 parent c519f44 commit 596b19f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Internal/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ public function parse(string $data = null) {
}

status_line_and_headers: {
if (preg_match(self::STATUS_LINE_PATTERN, $startLine, $m)) {
$this->protocol = $m['protocol'];
$this->responseCode = (int) $m['status'];
$this->responseReason = trim($m['reason']);
if (preg_match(self::STATUS_LINE_PATTERN, $startLine, $matches)) {
$this->protocol = $matches['protocol'];
$this->responseCode = (int) $matches['status'];
$this->responseReason = trim($matches['reason']);
} else {
throw new ParseException($this->getParsedMessageArray(), 'Invalid status line', 400);
}
Expand Down

0 comments on commit 596b19f

Please sign in to comment.