PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Structures » Structures_DataGrid » Bug #1739

Not working Structures_DataGrid_Record_DataObject

Details

Submitted2004-06-29 20:38 UTC
Frompavel dot kunc at beneta dot cz
Assignedasnagy
StatusClosed
PackageStructures_DataGrid
PHP Version5.0.0RC3 (Release Candidate 3)
OSWindows XP Prof.
Roadmaps(Not assigned)

Comments

[2004-06-29 20: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 {
...

[2004-07-15 13: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 13: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 17: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.