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.
Comments
Comment #2
amateescu commentedComment #3
Crell commentedThis will need to get backported, as the code in D7 is the same. (Since 2008, apparently...)
Comment #4
berdirSome 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.
Comment #5
alexpottIS this a dupe of #1476782: DatabaseStatementPrefetch::current PHP function array_unshift() are used incorrectly?
Comment #6
alexpottAnd #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
Comment #7
berdirIndeed, duplicate of that/those.