ZF-10069: setSubscription($data) always find $data in database


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) { ... }


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.

//same what not exists row to $id past, object returns Zend_Db_Table_Rowset
$result = $this->_db->find($key); 
if ($result) {  // always is true
    return true;

Fixed in trunk r22507.

Merged to branch release-1.10 r22509