-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When calling setValue Element\Select, selected incorrect values #52
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);
} Originally posted by @adamlundrigan at zendframework/zend-form#18 (comment) |
The issue is here: Originally posted by @adamlundrigan at zendframework/zend-form#18 (comment) |
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 Originally posted by @adamlundrigan at zendframework/zend-form#18 (comment) |
somehow the linked pull request hasn't closed this issue... |
Closed by #116
That's because nowhere in the PR nor in the merge commit there's a |
When calling $select->setValue(array('1.1')), selected values French and Japanese,
but Japanese is incorrect value
Originally posted by @googlle at zendframework/zend-form#18
The text was updated successfully, but these errors were encountered: