UnionOfRAD/lithium — Issue #247: infinite loop when using foreach on a MySQL result
Author: cgutierrez
Created: 2012-01-05 13:40:23+00:00
State: open

Hello!

I was seeing an infinite loop when iterating over a Result object after the recent PDO changes.

The main issue seemed to be the checks used in the `valid` method. The `valid` method checked to see if the `_resource` property was "truthy" or that the `_cache` property was empty. As far as I can tell, once you start iteration, any calls to the `valid` method would be true because the `_cache` property is not emptied.

I've added two tests to the Result test case and made a few minor tweaks to the my_sql\Result class @ 6eec7c84a182fba74f1a76068f114258883362c4