ZF-9704: Undefined offset in Zend_Db_Table_Row_Abstract::findDependentRowset()
Description
Create tables like in http://framework.zend.com/manual/en/… . Execute Example #1.
How to reproduce. 1. Add to class BugsProducts properties $_cols and $_primary. 2. Execute Example #1.
Problem: Undefined offset in Zend_Db_Table_Row_Abstract on line 902.
Reason. When $_cols and $_primary defined in class, metadata of table is not filled out and $dependentInfo[Zend_Db_Table_Abstract::METADATA] contains empty array (in Zend_Db_Table_Row_Abstract on line 902).
Comments
Posted by Ilia (iliavlad) on 2010-04-20T23:01:11.000+0000
There is same problem (undefined index) for find() function Zend_Db_Table_Abstract on line 1265
Posted by Jan Pieper (jpieper) on 2010-05-17T14:45:59.000+0000
Can you please provide a bit more information on how your modified class looks like? I am not able to reproduce this error.
Posted by Ilia (iliavlad) on 2010-05-17T16:34:39.000+0000
Hi, Could you please take a look to code below?
and run it
{quote} D:>php testbug.php PHP Notice: Undefined index: id in \Zend\Db\Table\Abstract.php on line 1265 PHP Stack trace: PHP 1. main D:\testbug.php:0 PHP 2. Zend_Db_Table_Abstract->find(1234) D:\testbug.php:78
Notice: Undefined index: id in \Zend\Db\Table\Abstract.php on line 1265
Call Stack: 0.0005 332816 1. main D:\testbug.php:0 0.0247 1792376 2. Zend_Db_Table_Abstract->find(1234) D:\testbug.php:78
PHP Notice: Undefined index: reported_by in \Zend\Db\Table\Row\Abstract.php on line 902 PHP Stack trace: PHP 1. main D:\testbug.php:0 PHP 2. Zend_Db_Table_Row_Abstract->findDependentRowset($dependentTable = 'Bugs', $ruleKey = uninitialized, $select = uninitialized) D:\testbug.php:80
Notice: Undefined index: reported_by in \Zend\Db\Table\Row\Abstract.php on line 902
Call Stack: 0.0005 332816 1. main D:\testbug.php:0 0.0440 2217512 2. Zend_Db_Table_Row_Abstract->findDependentRowset('Bugs', ???, ???) D:\testbug.php:80
array(1) [0]=> array(2) ["id"]=> string(1) "1" ["reported_by"]=> string(4) "1234"
{quote}
Posted by Jan Pieper (jpieper) on 2010-05-17T23:42:54.000+0000
Thanks, now I am able to reproduce this error.
Your tables are a bit different than these in the manual.
Posted by Jan Pieper (jpieper) on 2010-05-18T00:34:32.000+0000
This could be a possible fix but I need to verify to not break backward compatibility and/or any unittest.
Posted by Ilia (iliavlad) on 2010-05-18T15:44:47.000+0000
I add $_cols and $_primary to prevent "DESCRIBE
table" request which called from _setupMetadata(). But you want to change this behavior. Is it possible to fix the bug without calling _setupMetadata()?Thanks.