Problem/Motivation

There are at least two serious bugs (critical?) in that method.

$class_name = array_unshift($this->currentRow); ( it really wants array_shift() )

and:
return $this->currentRow[$k][$this->columnNames[$this->fetchOptions['column']]]; ($k is not defined)

Both lines have not been touched since 2008, although in the second, changing the surroundings might have broken somethings.

Apparently nobody noticed this until ultimate_cron tests on sqlite killed DrupalCI for hours because the second bug resulted in an endless loop (that eventually died due to a out of memory) that resulted in tens/hundreds of thousands of notices that d.o failed to parse.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Berdir created an issue. See original summary.

amateescu’s picture

Issue tags: +Needs backport to D7
Crell’s picture

This will need to get backported, as the code in D7 is the same. (Since 2008, apparently...)

berdir’s picture

Some more findings:

* FETCH_CLASS is simply not used in core, which is why nobody noticed.
* Core only uses fetchCol(), which Statement forwards to fetchAll() but StatementPrefetch does not. My module, which caused this, calls fetchAll(PDO::FETCH_COLUMN) explicitly.

alexpott’s picture

And #2499875: Fix bug with prefetch drivers and FETCH_CLASS feels related...

And this issue is ringing other bells but I can't find the issue I'm thinking off

berdir’s picture

Status: Active » Closed (duplicate)

Indeed, duplicate of that/those.