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:
parent
c97511c0d7
commit
20c10129c3
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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']]],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user