Dbal: Custom PDO fetch modes and 2.7.0

Created on 4 Apr 2018  路  7Comments  路  Source: doctrine/dbal

Announced as a deprecation only, an exception is thrown when passing unrecognized fetch modes, such as PDO::FETCH_KEY_PAIR. That is a BC break. In another instance, a silenced deprecation warning is issued instead.

While I completely agree on deprecating implicit usage of PDO features, I'd like a migration path that does not involve breaking working code. I suppose that some code depends on recognized fetch modes; I will investigate this and want to provide a pull request.

BC Break Bug Missing Tests PDO Regression

Most helpful comment

We see the problem coming up in PHPCR-ODM (because dbal is used in jackalope-doctrine-dbal) as well: https://travis-ci.org/doctrine/phpcr-odm/jobs/361545802#L474

Is there an easy fix for this? And should we change code that relied on this, or is it an intended feature?

All 7 comments

@corphi unlikely happened intentionally: if you have a piece of code that reproduces the regression, we can make a patch release with a fix.

@Ocramius for us it also breaks a piece of code.
We have the usage:
$stmt->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP) (it was fine since PDOStatement::fetchAll doc allowed bitwise-ORs for the fetch_style argument).

While we can of course refactor the code to use FETCH_ASSOC only and some array_* magic, I'm rather still in favor of silenced deprecation warning instead :)

Uhhh, I think we never considered bitmasking fetch modes on our side, so that is most likely lack of knowledge on our end.

We see the problem coming up in PHPCR-ODM (because dbal is used in jackalope-doctrine-dbal) as well: https://travis-ci.org/doctrine/phpcr-odm/jobs/361545802#L474

Is there an easy fix for this? And should we change code that relied on this, or is it an intended feature?

Same here, seeing the bitmasking fetch modes hitting us, breaking stable releases out there.

Test cases please: adding "me too" is NOT useful

Likely side-effect of #2996.

Was this page helpful?
0 / 5 - 0 ratings