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

Issue Type: Sub-task Created: 2009-03-19T03:30:29.000+0000 Last Updated: 2010-04-16T13:22:35.000+0000 Status: Resolved Fix version(s): Reporter: Giorgio Sironi (giorgiosironi) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: - ZF-8938

Attachments: - zf-6061-test.patch


'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.


Posted by Giorgio Sironi (giorgiosironi) on 2009-03-19T03:31:58.000+0000

Test for revealing incorrect current behavior.

Posted by Giorgio Sironi (giorgiosironi) on 2009-03-19T03:33:41.000+0000

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

Posted by Giorgio Sironi (giorgiosironi) on 2009-03-19T03:35:01.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2009-03-19T04:18:12.000+0000

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.

Posted by Christian Albrecht (alab) on 2010-03-06T18:48:01.000+0000

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

Posted by Christian Albrecht (alab) on 2010-03-18T08:31:21.000+0000

Fixed in [ZF-9401]

Posted by Christian Albrecht (alab) on 2010-03-25T13:24:00.000+0000

Reopened because suggested fix is not reviewed and committed yet.

Posted by Christian Albrecht (alab) on 2010-04-16T13:22:35.000+0000

Fixed in parent ZF-9401

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.