Home » Caching » Cache » Bug #1721
fetchRow method in Cache_DB_Result: cursor is off by one
Details
| Submitted | 2004-06-25 20:02 UTC |
|---|---|
| From | dmintz at davidmintz dot org |
| Status | Wont fix |
| Package | Cache |
| PHP Version | 4.3.4 |
| OS | Windows 2000 |
| Roadmaps | (Not assigned) |
Comments
[2004-06-25 20:02 UTC] dmintz at davidmintz dot org
Description:
------------
/**
* Cache_DB_Result
*
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @module Cache_DB
* @modulegroup Cache_DB
* @package Cache
* @version $Revision: 1.7 $
* @access public
*/
cursor in fetchrow() method is one too high when called inside a while loop. the first record is skipped, and the cursor overruns the end of $this->rows
Reproduce code:
---------------
see http://davidmintz.org/code/DB_Cache_bug.phps, where I point out the broken part and suggest a fix
Expected result:
----------------
You should get this:
1: Mintz, David
2: Shmoe, Joe
3: Bludgeon, Vernon T.
4: DeLillo, Don
Actual result:
--------------
but you do get this:
2: Shmoe, Joe
3: Bludgeon, Vernon T.
4: DeLillo, Don
Notice: Undefined offset: 4 in c:\php\pear\Cache\DB.php on line 331
[2004-06-25 20:05 UTC] dmintz at davidmintz dot org
it seems the trailing comma got appended to the url in my post. try this:
http://davidmintz.org/code/DB_Cache_bug.phps