#5846: fetchAll causes infinite loop in ADODB
--------------------------+-------------------------------------------------
Reporter: aspeakman | Type: Bug
Status: new | Priority: High
Milestone: 1.2.x.x | Component: ADODB
Version: RC3 | Severity: Major
Keywords: | Php_version: PHP 5
Cake_version: |
--------------------------+-------------------------------------------------
In DboSource::fetchAll() there is a loop to collect multiple result rows
after the first one, as follows:
{{{
while ($this->hasResult() && $item = $this->fetchResult()) {
$out[] = $item;
}
}}}
This does not work when using the ADODB driver because
DboAdodb::fetchResult() causes an infinite loop leading to a memory
overflow or execution time error.
The problem is the first section of code in DboAdodb::fetchResult(), as
follows:
{{{
if (!empty($this->results)) {
$row = $this->results;
} else {
$row = $this->_result->FetchRow();
}
}}}
The global pointer to the first result row ($this->results) is not set to
null after it is consumed. This means that after the first iteration the
!empty() test always returns true and the next row is never fetched.
This is the fix as suggested in [http://trac.cakephp.org/ticket/5227]
{{{
if (!empty($this->results)) {
$row = $this->results;
$this->results = null;
} else {
$row = $this->_result->FetchRow();
}
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5846>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---