Skip to content

PDO::getAttribute() does not support PDO::ATTR_TIMEOUT  #2034

@shyim

Description

@shyim

Description

The following code:

<?php

$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';

$pdo = new PDO($dsn, $user, $password);
$pdo->setAttribute(\PDO::ATTR_TIMEOUT, 5);

var_dump($pdo->getAttribute(\PDO::ATTR_TIMEOUT));

It seems like not covered by https://github.com/php/php-src/blob/master/ext/pdo_mysql/mysql_driver.c#L490

Resulted in this output:

Fatal error: Uncaught PDOException: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute

But I expected this output instead:

int(5)

PHP Version

PH P 8.1.12

Operating System

macOS Ventura 13.1 Beta 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Extension: pdoAll PDO related doc issuesbugDocumentation contains incorrect information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions