Skip to content

PDO::getAttribute() of an unsupported attribute resets errorInfo code and message instead of keeping the previous ones #327

Closed

Description

@blacktrs

Summary

PDO::getAttribute() of an unsupported attribute resets errorInfo code and message instead of keeping the previous ones.

Repro

<?php
set_error_handler(function ($n, $s) { return true; });
$db = new PDO('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT]);
$db->exec('selec');
$db->getAttribute(9999);
echo json_encode($db->errorInfo()), "\n";

Expected (php)

["IM001",1,"near \"selec\": syntax error"]

Actual (manticore ea11f898, Darwin arm64)

["IM001",null,null]

Tracking

Known-bug repro: tests/aot/repro/wrong/pdo_getattribute_im001_keeps_previous_error.php — bash tests/aot/xfail.sh -k pdo_getattribute_im001_keeps_previous_error reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions