This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
When calling setValue Element\Select, selected incorrect values #18
Labels
Comments
Confirmed. The following test fails when added to public function testIssue18()
{
$select = new SelectElement('language');
$select->setLabel('Which is your mother tongue?');
$select->setAttribute('multiple', true);
$select->setValueOptions(array(
'1.1' => 'French',
'1.2' => 'English',
'1.10' => 'Japanese',
'1.20' => 'Chinese',
));
$select->setValue(array('1.1'));
$this->assertEquals(array('1.1'), $select->getValue());
$markup = $this->helper->render($select);
$this->assertRegExp('{value="1.1" selected="selected"}i', $markup);
$this->assertNotRegExp('{value="1.2" selected="selected"}i', $markup);
$this->assertNotRegExp('{value="1.10" selected="selected"}i', $markup);
$this->assertNotRegExp('{value="1.20" selected="selected"}i', $markup);
} |
The issue is here: |
The underlying issue here is with <?php
$needle = '1.10';
$haystack = ['1.1'];
assert(in_array($needle, $haystack) === false);
// PHP Warning: assert(): Assertion failed in <file> on line 5 (3v4l: https://3v4l.org/HKM8Q) The last argument of the |
This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at laminas/laminas-form#52. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When calling $select->setValue(array('1.1')), selected values French and Japanese,
but Japanese is incorrect value
The text was updated successfully, but these errors were encountered: