Skip to content

var_dump of an object produced by PDO::FETCH_CLASS with constructor arguments prints a stdClass with a garbage property count. #303

Closed

Description

@blacktrs

Summary

var_dump of an object produced by PDO::FETCH_CLASS with constructor arguments prints a stdClass with a garbage property count.

Repro

<?php
class Row { public $a; public $b; public function __construct(public string $tag = 'none') {} }
$db = new PDO('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$st = $db->query("select 1 as a, 'x' as b");
var_dump($st->fetchAll(PDO::FETCH_CLASS, 'Row', ['T']));

Expected (php)

array(1) {
  [0]=>
  object(Row)#3 (3) {
    ["a"]=>
    int(1)
    ["b"]=>
    string(1) "x"
    ["tag"]=>
    string(1) "T"
  }
}

Actual (manticore e1d451af, Darwin arm64)

array(1) {
  [0]=>
  object(stdClass)#1 (-268435371) {
  }
}

Tracking

Known-bug repro: tests/aot/repro/wrong/pdo_fetch_class_ctor_args_var_dump_garbage.php — bash tests/aot/xfail.sh -k pdo_fetch_class_ctor_args_var_dump_garbage 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