PHP automatically parses parameters in an array notation(foo[]) into
array types. Ignore these parameters as 'unknown'.
Fixes #2763.
public function getBool($sName, $bDefault = false)
{
public function getBool($sName, $bDefault = false)
{
- if (!isset($this->aParams[$sName]) || strlen($this->aParams[$sName]) == 0) {
+ if (!isset($this->aParams[$sName])
+ || !is_string($this->aParams[$sName])
+ || strlen($this->aParams[$sName]) == 0
+ ) {
public function getInt($sName, $bDefault = false)
{
public function getInt($sName, $bDefault = false)
{
- if (!isset($this->aParams[$sName])) {
+ if (!isset($this->aParams[$sName]) || is_array($this->aParams[$sName])) {
public function getFloat($sName, $bDefault = false)
{
public function getFloat($sName, $bDefault = false)
{
- if (!isset($this->aParams[$sName])) {
+ if (!isset($this->aParams[$sName]) || is_array($this->aParams[$sName])) {
public function getString($sName, $bDefault = false)
{
public function getString($sName, $bDefault = false)
{
- if (!isset($this->aParams[$sName]) || strlen($this->aParams[$sName]) == 0) {
+ if (!isset($this->aParams[$sName])
+ || !is_string($this->aParams[$sName])
+ || strlen($this->aParams[$sName]) == 0
+ ) {
public function getSet($sName, $aValues, $sDefault = false)
{
public function getSet($sName, $aValues, $sDefault = false)
{
- if (!isset($this->aParams[$sName]) || strlen($this->aParams[$sName]) == 0) {
+ if (!isset($this->aParams[$sName])
+ || !is_string($this->aParams[$sName])
+ || strlen($this->aParams[$sName]) == 0
+ ) {
+ Scenario: Array parameters are ignored
+ When sending json search query "Vaduz" with address
+ | countrycodes[] | polygon_svg[] | limit[] | polygon_threshold[] |
+ | IT | 1 | 3 | 3.4 |
+ Then result addresses contain
+ | ID | country_code |
+ | 0 | li |
public function testGetSet()
{
public function testGetSet()
{
- $this->expectException(\Exception::class);
- $this->expectExceptionMessage("Parameter 'val3' must be one of: foo, bar");
-
$oParams = new ParameterParser(array(
'val1' => 'foo',
'val2' => '',
$oParams = new ParameterParser(array(
'val1' => 'foo',
'val2' => '',
$this->assertSame('foo', $oParams->getSet('val1', array('foo', 'bar')));
$this->assertSame(false, $oParams->getSet('val2', array('foo', 'bar')));
$this->assertSame('foo', $oParams->getSet('val1', array('foo', 'bar')));
$this->assertSame(false, $oParams->getSet('val2', array('foo', 'bar')));
- $oParams->getSet('val3', array('foo', 'bar'));
+ $this->assertSame(false, $oParams->getSet('val3', array('foo', 'bar')));