Skip to content

Deprecated warnings in PHP 8.5 for configuration with MySql specific PDO-Constants and dosnt respect the new constants for eg. Pdo\Mysql #333

Description

@micha-walter

Version: 3.2.9

PHP-Version: 8.5.9

Bug Description

In PHP 8.5 and deprecated warnings = on, we recive this warning:
Constant PDO::MYSQL_ATTR_SSL_CA is deprecated since 8.5, use Pdo\Mysql::ATTR_SSL_CA instead

All new constants for eg. Pdo\Mysql are not recognized by the configuration because the regex is not matching.

Steps To Reproduce

Configure the database (MySql) in local.neon e.g. for SSL:

database:
  default:
    dsn: 'mysql:...'
    user: '...'
    password: '...'
    options:
      PDO::MYSQL_ATTR_SSL_CA: '/pathtoca'

Expected Behavior

Please accept all new constants for PDO, see https://www.php.net/manual/en/ref.pdo-mysql.php#ref.pdo-mysql.constants

PDO::XYZ_ABC
Pdo\Mysql::ATTR_SSL_CA
... and so on

Please observe the capitalization specified in the manual.
The "PDO::" constant prefix is written in uppercase: https://www.php.net/manual/en/pdo.constants.php
The "Pdo\Mysql::" constant prefix is written in UpperCamelCase: https://www.php.net/manual/en/class.pdo-mysql.php#pdo-mysql.constants

The capitalization is for the function constant(...) irrelevant, but for the readness i will prefer the correct capitalization.

Possible Solution

In function Bridges\DatabaseDI\DatabaseExtension.php::setupDatabase() line 84

The regex should be: '#^PDO(|\\\\\w+)::\w+$#Di'
This would match 'PDO' followed nothing else as "::" and 'Pdo\XyZ' followed "::".
I hope that covers all cases. But I'm not sure.

Thank you for your work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions