Closed
Description
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