You're right. But the real bug is that the Move(0) should never have needed to be followed by MoveNext().
I think my advice was always to never rely on using Move(0) because I knew this bug existed but hadn't been fixed.
Regardless, you're right: plugins that relied on using Move(0) will have unexpected results.
The better way, moving forward, is to use the Iterator approach instead of the old "while(!EOF) { // work; MoveNext() }" approach.
OLD WAY:
NEW WAY:Code:$result = $db->Execute($sql); while (!$result->EOF) { $data = $result->fields['filename']; //foo $result->MoveNext(); }
Note that with the foreach() approach, MoveNext() is dropped altogether.Code:$result = $db->Execute($sql); foreach ($result as $row) { $bar = $row['fieldname']; } // To reset and loop again, use: reset($result);
And reset() is used instead of Move(0) (although Move(0) will indeed do the same as reset() now)
I suppose for compatibility, you could try testing whether method_exists($result, 'rewind') to determine if your plugin needs to add a MoveNext() after the old Move(0).


Reply With Quote
