Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portability\Statement incorrectly handles fetchAll(PDO::FETCH_COLUMN) #2644

Closed
morozov opened this issue Feb 7, 2017 · 1 comment
Closed

Comments

@morozov
Copy link
Member

morozov commented Feb 7, 2017

The Portability\Statement::fixRow() implementation doesn't take into account that mixed $row is not always iterable (particularly in the case if $fetchMode = PDO::FETCH_COLUMN).

use Doctrine\DBAL\Portability\Connection;
use Doctrine\DBAL\DriverManager;

$conn = DriverManager::getConnection(array(
    'driver' => 'ibm_db2',
    'wrapperClass' => Connection::class,
    'portability' => Connection::PORTABILITY_FIX_CASE,
    'fetch_case' => PDO::CASE_LOWER,
));

$conn->executeQuery('SELECT id FROM users')
    ->fetchAll(\PDO::FETCH_COLUMN);

Produces:

Warning: Invalid argument supplied for foreach() in vendor/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php on line 203

Besides that, the Portability\Statement::connect() implementation forcedly replaces the portability value from whatever provided in the connection parameters with PORTABILITY_DB2 which is inconsistent with the rest of the supported platforms.

@github-actions
Copy link

github-actions bot commented Aug 6, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants