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

Bug #1739 Not working Structures_DataGrid_Record_DataObject
Submitted: 2004-06-29 15:38 UTC Modified: 2004-07-15 12:45 UTC
From: pavel dot kunc at beneta dot cz Assigned: asnagy
Status: Closed Package: Structures_DataGrid
PHP Version: 5.0.0RC3 (Release Candidate 3) OS: Windows XP Prof.
Roadmaps: (Not assigned)    
Subscription  


 [2004-06-29 15:38 UTC] pavel dot kunc at beneta dot cz
Description: ------------ Using Structures_DataGrid v. 0.5.1 I tried to use DataObjects to fill the DataGrid with rows. But the DataGrid didn't fill any data to the DG object actually even to the record object. I tried to debug and find out that the setRecord() method in the Structures_DataGrid_Record_DataObject class compare the parent class in a wrong way. The problem is in the capital letters. It was enough to put strtolower() to the condition. Reproduce code: --------------- Script: $oRecord->setRecord($oPolozka); print_r($oRecord); Result: Structures_DataGrid_Record_DataObject Object ( [_record] => Array() ) Original code: ... if (get_parent_class($data) == 'db_dataobject') { parent::setRecord($data->toArray()); } else { ... After this works well: ... if (strtolower(get_parent_class($data)) == 'db_dataobject') { parent::setRecord($data->toArray()); } else { ...

Comments

 [2004-07-15 08:12 UTC] asnagy at webitecture dot org
I will investigate this. Are you using PHP 5? Have you tested this on PHP 4?
 [2004-07-15 08:34 UTC] pavel dot kunc at beneta dot cz
Hello, I tested it on PHP4 and your original code works well. But in PHP5 there is a backward incompatibility in the return value of the get_class() function. This is snap from the PHP manual: get_class() starting PHP 5 returns the name of the class as it was declared which may lead to problems in older scripts that rely on the previous behaviour (the class name was lowercased). A possible solution is to search for get_class() in all your scripts and use strtolower(). Best regards Pavel Kunc
 [2004-07-15 12:45 UTC] asnagy at webitecture dot org
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.