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

DataAccessTest::testFetchColumnNonExistingIndex() covers a PDO bug #3358

Closed
morozov opened this issue Nov 27, 2018 · 1 comment
Closed

DataAccessTest::testFetchColumnNonExistingIndex() covers a PDO bug #3358

morozov opened this issue Nov 27, 2018 · 1 comment

Comments

@morozov
Copy link
Member

morozov commented Nov 27, 2018

According to the discussion in php/php-src#3655, the fact that PDOStatement::fetchColumn() returns null for an invalid column index, is a bug. Starting 7.2.14 and other newer PHP versions, DataAccessTest::testFetchColumnNonExistingIndex() will fail:

↪ php --version
PHP 7.2.14-dev (cli) (built: Nov 26 2018 15:14:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

↪ phpunit --filter testFetchColumnNonExistingIndex tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
PHPUnit 7.4.0 by Sebastian Bergmann and contributors.

Testing Doctrine\Tests\DBAL\Functional\DataAccessTest
E                                                                                   1 / 1 (100%)

Time: 39 ms, Memory: 6.00MB

There was 1 error:

1) Doctrine\Tests\DBAL\Functional\DataAccessTest::testFetchColumnNonExistingIndex
Exception: [Doctrine\DBAL\Driver\PDOException] SQLSTATE[HY000]: General error: Invalid column index

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

This test was introduced as part of #709 but it doesn't cover the issue which was fixed.

Instead of supporting this behavior by means of a workaround, I think we should just remove the test and document the changes. Invalid column index usually is a sign of a logical error in the client code and shouldn't be silently suppressed by the DBAL.

@github-actions
Copy link

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 Jul 31, 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

1 participant