Skip to content

var_dump and (array) list a virtual (hook-only, no backing store) property; php leaves it out of both. #449

Closed

Description

@blacktrs

Summary

var_dump and (array) list a virtual (hook-only, no backing store) property; php leaves it out of both.

Repro

<?php
class K
{
    public int $real = 1;
    public int $virt { get => 42; }
}

$k = new K();
var_dump($k);
var_dump((array) $k);
var_dump(get_object_vars($k));
foreach ($k as $n => $v) {
    echo $n, "\n";
}

Expected (php)

object(K)#1 (1) {
  ["real"]=>
  int(1)
}
array(1) {
  ["real"]=>
  int(1)
}
array(2) {
  ["real"]=>
  int(1)
  ["virt"]=>
  int(42)
}
real
virt

Actual (manticore 7c330c5a, Darwin arm64)

object(K)#1 (2) {
  ["real"]=>
  int(1)
  ["virt"]=>
  int(42)
}
array(2) {
  ["real"]=>
  int(1)
  ["virt"]=>
  int(0)
}
array(2) {
  ["real"]=>
  int(1)
  ["virt"]=>
  int(0)
}
real
virt

Tracking

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