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

Bug #10590 removeColumn may fail in php4
Submitted: 2007-04-02 11:26 UTC Modified: 2007-04-12 09:46 UTC
From: chrismir Assigned: wiesemann
Status: Closed Package: Structures_DataGrid (version 0.8.2)
PHP Version: 4.3.11 OS: Linux (debian)
Roadmaps: (Not assigned)    
Subscription  


 [2007-04-02 11:26 UTC] chrismir (Chris Van De Wouw)
Description: ------------ removeColumn uses object comparison (DataGrid.php, line 1088), which may lead to the following php error: Fatal error: Nesting level too deep - recursive dependency? in /usr/share/php/Structures/DataGrid.php on line 1088 This happens when the column in subject has a formatter set with a class/method callback type, with the class harboring a circular/recursive reference. As php4 compares objects, not by reference, but by all attributes recursively, the comparison would go on forever. Test script: --------------- class Test { function Test() { $this->dg =& new Structures_DataGrid(); $this->dg->bind('SELECT * FROM my_table', $options); $column =& $this->dg->getColumnByField('id'); $column->setFormatter(array (&$this, 'formatter')); $this->dg->removeColumn($column); } function formatter($param) { // format string } } Expected result: ---------------- hidden column Actual result: -------------- Fatal error: Nesting level too deep - recursive dependency? in /usr/share/php/Structures/DataGrid.php on line 1088

Comments

 [2007-04-03 10:55 UTC] wiesemann (Mark Wiesemann)
Your example class fails also with PHP 5.2. I'll try to find a solution.
 [2007-04-12 09:46 UTC] wiesemann (Mark Wiesemann)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Structures_DataGrid