ZF-9675: Using _postInsert() to save() creates an infinite loop - Zend_Db_Table_Row_Abstract

Description

If save() is triggered by _postInsert() (within the function itself or by code it executes), an infinite loop is created. This happens because _refresh(), which creates clean data, is called AFTER postInsert() and the save() function determines if it's calling an insert or an update based on the presence of clean data. When it doesn't find clean data (because _refresh() hasn't been called yet), it calls insert() (again), which calls _postUpdate() (again), which creates an infinite loop.

You can fix the problem by manually calling _refresh() from within _postUpdate() before a save() is called, but I suspect any developer who runs into this issue will spend a few hours cursing before he figures that out.

It should be fixed.

Comments

I'm also having this issue.

I can't think of any case where it would cause a problem (off the top of my head), but maybe you could move the _postInsert() call to after the _refresh() call?