Skip to content

A float or null array key is not converted: php uses key 1 for 1.7 and "" for null #404

Closed

Description

@blacktrs

Summary

A float or null array key is not converted: php uses key 1 for 1.7 and "" for null.

Repro

<?php
$a = [];
$k = 1.7;
$a[$k] = 'f';
$a[null] = 'n';
var_dump(array_keys($a));

Expected (php)

array(2) {
  [0]=>
  int(1)
  [1]=>
  string(0) ""
}

Actual (manticore 57b5de57, Darwin arm64)

array(2) {
  [0]=>
  int(4610334938539176755)
  [1]=>
  int(4610334938539176756)
}

Tracking

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