zendframework/zf2 — pull request #4529 by sjuvonen (2013-05-23 13:30:08+00:00)
Title: Allow Zend\Form\Element\Checkbox to return real value instead of always a boolean

This PR will fix the way Zend's Checkbox element handles values. The Checkbox element allows us to set any value as checked/unchecked value via setCheckedValue() and setUncheckedValue(). The default value is (string) 1 for checked state.

The bug is that currently Checkbox will not follow these values based on its check state. Instead Checkbox::getValue() always returns a boolean true/false. After this patch Checkbox will return the value of getUncheckedValue() when isChecked() return false and value of getCheckedValue() when isChecked() returns true.

I also updated the ZendTest\Form\Element\CheckboxTest::testSetAttributeValue() to cover these other use-cases.