Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #1931 Associative array options call not working in create
Submitted: 2004-07-21 00:33 UTC
From: marcelo at beteltecnologia dot com dot br Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: 4.3.7 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 11 + 9 = ?

 
 [2004-07-21 00:33 UTC] marcelo at beteltecnologia dot com dot br
Description: ------------ calling create method with associative array options didnĀ“t work for change of form_header_text. I managed to find the problem: Since default form_header_text is set to null, isset equals false, the code in the constructor is preventing the setting, especifically the if (isset($this->$key)) in the loop for $options. Below I point the broken code at the class constructor. Reproduce code: --------------- function DB_DataObject_FormBuilder(&$do, $options=false) { global $_DB_DATAOBJECT_FORMBUILDER; // Set default callbacks first! $this->_dateToDatabaseCallback = array($this,'_array2date'); $this->_dateFromDatabaseCallback = array($this,'_date2array'); // Read in config if (is_array($options)) { reset($options); while (list($key, $value) = each($options)) { if (isset($this->$key)) { //<=PROBLEM FOR $this->form_header_text! $this->$key = $value; } } } ... Expected result: ---------------- I only ask: Why is this condition being tested since I am setting the variable and should'nt matter if it is or not already set? Thanks and keep going because your class is very nice!

Comments

 [2004-07-21 03:34 UTC] justinpatrin
This was fixed in CVS a little while ago. isset() was used to make sure that the property was allowed to be set. Now, get_class_vars() is used. Be careful if you upgrade to the newest CVS version, there are BC breaks.