Skip to content

PDO DSN generation failes when initStatement contains ; #6526

Closed
@tomvlk

Description

@tomvlk

Preconditions

  1. Install Magento2 with setup (MySQL), don't change default initStatement.

Steps to reproduce

  1. Edit the app/etc/env.php.
  2. Change the order of the default db connection configuration.
  3. Make sure that initStatement is the upper most entry.
  4. Reload page or run CLI tool.

Expected result

  1. Working site with selected DB.

Actual result

  1. The DSN will contain the initStatement with ; sign. Resulting in:
mysql:host=localhost;model=mysql4;active=1;initStatements=SET NAMES utf8;;dbname=test_db;engine=innodb;type=pdo_mysql

The problem will be between the initStatements= and the dbname=. The dubble semicolon will result in ignoring everything after it.

By default the Magento setup will add initStatements with the semicolon on the end, which is the failt. The only reason why it isn't failing on all environments is order of the env.php array which will ignore nothing on the end of the generated DSN.

This affects Magento 2.1.1 and (not yet tested) everything < 2.1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug reporttriage wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions