ZF-10069: setSubscription($data) always find $data in database
Description
Under Zend/Feed/Pubsubhubbub/Model/Subscription.php one finds the function setSubscription($data) with code (line 54):
$result = $this->_db->find($data['id']);
if ($result) { ... }
At least in my application, where _db is a Mysqli interface, $result is always evaluated to true even if no rows are found.
Shouldn't the test be done instead with count()?
$result = $this->_db->find($data['id']);
if (count($result)>0) { ... }
Comments
Posted by Ramon Henrique Ornelas (ramon) on 2010-06-28T17:25:14.000+0000
This problem occur in all method of Zend_Feed_Pubsubhubbub_Model_Subscription. Because Zend_Db_Table:>find() returns Zend_Db_Table_Rowset.
In This case the condition always is true. Sample code.
Posted by Ramon Henrique Ornelas (ramon) on 2010-06-30T12:16:46.000+0000
Fixed in trunk r22507.
Posted by Ramon Henrique Ornelas (ramon) on 2010-06-30T13:56:39.000+0000
Merged to branch release-1.10 r22509