Skip to content

foreach over an object taken from an array of objects of different classes yields none of its properties. #122

Closed

Description

@blacktrs

Summary

foreach over an object taken from an array of objects of different classes yields none of its properties.

Repro

<?php
final class P { public int $a = 1; }
foreach ([new P(), (object) ['x' => 1]] as $o) {
    foreach ($o as $k => $v) { echo $k, '=', $v, "\n"; }
}
echo "end\n";

Expected (php)

a=1
x=1
end

Actual (manticore 46bda0f8, Darwin arm64)

end

Tracking

Known-bug repro: tests/aot/repro/wrong/foreach_mixed_class_objects_no_props.php — bash tests/aot/xfail.sh -k foreach_mixed_class_objects_no_props 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 7, 2026
  2. added a commit that references this issue on Oct 11, 2026
    8d472d6
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