Skip to content

Unable to check PDO::ATTR_STRINGIFY_FETCHES configuration #12969

Closed
@janedbal

Description

@janedbal

Description

The following code:

<?php
$pdo = new PDO('mysql:host=mysql;port=3306', 'root', 'secret');
var_dump(
    $pdo->getAttribute(PDO::ATTR_STRINGIFY_FETCHES)
);

Resulted in this output:

Fatal error: Uncaught PDOException: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /app/pdo.php on line 3

But I expected this output instead:

int(0);

It seems like I cannot verify how PDO is configured regarding this option. When $pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true) is used, true is returned and the behaviour changes. This behaviour applies for at least mysql, pgsql and sqlite.

Full dockerized replication repository: https://github.com/janedbal/php-pdo-get-attribute-bug

PHP Version

PHP 8.3.0

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions