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

Removed DataAccessTest::testFetchColumnNonExistingIndex() since it covers a bug in PDO #3359

Merged
merged 1 commit into from
Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Upgrade to 2.9

## Deprecated `Statement::fetchColumn()` with an invalid index

Calls to `Statement::fetchColumn()` with an invalid column index currently return `NULL`. In the future, such calls will result in a exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is not entirely true considering that errors will be triggered by PHP itself and we are propagating them already. I would even question if this is a deprecation at all as it is undocumented behaviour. Our API does not tell anything about invalid index and null. Also why would someone expect such behaviour when it is clearly a bug in the client code? Even if someone would use null to tell whether the index in question is out of range, you couldn't even safely do that because null is not distinguishable from a regular index null.
IMO we could simply implement exceptions and maybe rather document it as "minor BC break" (even though it still is nothing we ever intended to support).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is not entirely true considering that errors will be triggered by PHP itself and we are propagating them already.

And besides that, we'll throw an exception in 3.0.

I would even question if this is a deprecation at all as it is undocumented behaviour. Our API does not tell anything about invalid index and null.

Our existing tests do if we consider them documentation. That's the primary reason why I didn't want to change the behavoir in 2.9.

IMO we could simply implement exceptions and maybe rather document it as "minor BC break" (even though it still is nothing we ever intended to support).

I was trying to be more conservative but I'm not against this approach. If noone else is against it, we can implement exceptions in 2.9 instead of 3.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the breaking part based on #3369 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO better to not tease consumers with sneaky exceptions, unless it's a security issue or so.


## Deprecated `Configuration::getFilterSchemaAssetsExpression()`, `::setFilterSchemaAssetsExpression()` and `AbstractSchemaManager::getFilterSchemaAssetsExpression()`.

Regular expression-based filters are hard to extend by combining together. Instead, you may use callback-based filers via `::getSchemaAssetsFilter()` and `::getSchemaAssetsFilter()`. Callbacks can use regular expressions internally.
Expand Down
16 changes: 0 additions & 16 deletions tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,22 +888,6 @@ public function testFetchColumnNullValue()
);
}

/**
* @group DBAL-1028
*/
public function testFetchColumnNonExistingIndex()
{
if ($this->connection->getDriver()->getName() === 'pdo_sqlsrv') {
$this->markTestSkipped(
'Test does not work for pdo_sqlsrv driver as it throws a fatal error for a non-existing column index.'
);
}

self::assertNull(
$this->connection->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', [1], 1)
);
}

/**
* @group DBAL-1028
*/
Expand Down