It appears that either a typo or an oversight led to the php coding violation found on line 287 of the Database Core code in StatementPrefetch.php.
This code appears to only effect the SQLite database driver.
here's an attempt to fix the error by changing array_unshift into array_shift. Given the fact that only one argument is provided, and I can't think of what the second argument should be, that's what I"m going with.
Experts: please advise on what the proper fix should be.
ALSO, found another error on line 311 where case PDO::FETCH_COLUMN: used a mutli-dimension array for currentRow. I'm not sure if this is the proper fix but the $k variable it was using was undefined so I got rid of it.
Let's see what the testbots say:
| Comment | File | Size | Author |
|---|---|---|---|
| statmentprefetch.patch | 1.15 KB | cosmicdreams |
Comments
Comment #1
xjmThanks for looking into this. However, I am unsure why this patch is needed. If it were a syntax error, there would be a syntax error. The code would not compile.
Comment #2
cosmicdreams commentedxjm: are you saying that the code is correct without the patch? or that there is something else going on?
Comment #3
xjmThe former. I do not think the patch is needed. It looks like valid PHP to me. And if it weren't, it would blow up whenever the file is loaded, and drush si installs using SQLite so it seems very unlikely no one has ever loaded this file. :)
Marking "works as designed" unless we can get a clear indication that there is a problem with this code.
Comment #4
cosmicdreams commentedas you can see from php's documentation here: http://www.php.net/manual/en/function.array-unshift.php the second parameter is not optional. Does that convince you of the syntactical incorrectness of this line of code?
Comment #5
xjmAlright, if this is invalid PHP, we need an automated test covering this code, because it's clearly not getting run on the bot. Thanks @cosmicdreams!
We should be seeing:
Warning: Wrong parameter count for array_unshift() in /.../... on line NComment #6
sunThis part of the patch duplicates #1476782: DatabaseStatementPrefetch::current PHP function array_unshift() are used incorrectly
Comment #7
jhedstromMarking this as a duplicate of #1476782: DatabaseStatementPrefetch::current PHP function array_unshift() are used incorrectly. This part of the patch:
Needs to be ported over to that issue's patch.