Issues

ZF2-188: PDO driver options are reindexed

Description

When creating a new PDO connection, the driver options array is reindexed, which then makes PDO to behave strangely (will explain this in detail in a bit).

The offending line is this one: https://github.com/zendframework/zf2/… - the array_merge reindexes the keys.

It was noticed that when passing PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" to the driver options, instead of 1002 as the key (which is the value of PDO::MYSQL_ATTR_INIT_COMMAND), the key is 0.

The arrays need to be merged/combined in such way that the numeric keys are left intact.

The "strange behaviour" is that SELECT statements are working fine, but the INSERT/UPDATE/DELETE statements don't. No errors, warnings, messages, nothing - all went fine, except the database was never updated. I step debugged the entire INSERT process but found nothing which could help me define this with anything but "strange behaviour", nor do I know how to write a test case for this one.

Comments

Pull request merged by Ralph Schindler.