ZF-6062: setElementsBelongTo() does not allow '0' value, but it is permitted for form name


'0' is a valid key for an array, so a subform should permit its elements to belong to such a key. Other numeric values like '1' and '2' are currently permitted.


Test for revealing incorrect current behavior.

Patch for FormTest.php with the correct name - please ignore previous one.

Patch for resolving the issue. Obtained against and to be applied, like the test, to 1.7 branch.

Sorry, but this won't be accepted at this time.

The reason numeric values are not allowed as names of elements, sub forms, and display groups has to do with a design decision to allow overloading to retrieve each of these items. Overloading requires valid PHP variable names.

There are a number of requests similar to yours, and we will likely re-evaluate this decision for 2.0; however before then, making such a change would break existing behavior.

class Test { public function __construct() { $test = 0; $this->$test = 1; var_dump( $this->$test ); } }

Fix for the whole Zend_Form package in ZF-ver-1.10.2-Fix-Issue-ZF-9350-Zend_Form.diff

Fixed in [ZF-9401]

Reopened because suggested fix is not reviewed and committed yet.

Fixed in parent ZF-9401