1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-12 03:24:26 +01:00

Fix to ensure that repeated values are parsed correctly

This commit is contained in:
Michael Dowling 2014-07-11 17:54:10 -07:00
parent c97511c0d7
commit 20c10129c3
2 changed files with 5 additions and 1 deletions

View File

@ -51,8 +51,9 @@ class QueryParser
} else {
$this->duplicates = true;
if (!is_array($result[$key])) {
$result[$key] = [$result[$key], $value];
$result[$key] = [$result[$key]];
}
$result[$key][] = $value;
}
}

View File

@ -44,6 +44,9 @@ class QueryParserTest extends \PHPUnit_Framework_TestCase
]],
// Can parse PHP style arrays
['a[b]=c&a[d]=e', ['a' => ['b' => 'c', 'd' => 'e']]],
// Ensure it doesn't leave things behind with repeated values
// Can parse mult-values items
['q=a&q=b&q=c', ['q' => ['a', 'b', 'c']]],
];
}