Issues

ZF2-188: PDO driver options are reindexed

Issue Type: Bug Created: 2012-03-03T12:56:20.000+0000 Last Updated: 2012-03-04T17:11:13.000+0000 Status: Resolved Fix version(s): Reporter: Robert Basic (robertbasic) Assignee: Ralph Schindler (ralph) Tags: - Zend\Db

Related issues: Attachments:

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

Posted by Robert Basic (robertbasic) on 2012-03-03T13:19:54.000+0000

Pull request sent: https://github.com/zendframework/zf2/pull/879

Posted by Robert Basic (robertbasic) on 2012-03-04T17:11:13.000+0000

Pull request merged by Ralph Schindler.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts