Skip to content

Conversation

@stephenkeatley-eagleeye

Added support so maps allow both strings and ints as keys.

Keys in PHP arrays will automatically cast to integers if all characters are integer digits. This change allows both strings and ints in the validation and then casts the key to a string when doing the actual encoding.

e.g.

{
  "mapContainer": {
    123: "value1",    // invalid before because it's an int, ok now
    "456": "value2",  // invalid before because array key gets converted to int, ok now
    "myKey": "value4" // ok before and now, stays as a string because not all int characters
  }
}

@stephenkeatley-eagleeye stephenkeatley-eagleeye changed the title AIR-33014: Maps allow integers as keys Maps allow integers as keys Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant