Skip to content

v1.37.2

Choose a tag to compare

@mathsgod mathsgod released this 01 Jun 04:07
· 16 commits to main since this release

Fix bind() for nullable GraphQLite input fields

Fix Model::bind() to correctly handle unset nullable fields when using GraphQLite 8.3 input types.

Root cause

GraphQLite automatically adds defaultValue = null in the GraphQL schema for nullable properties (?int, ?string). When a field is not provided in a mutation, graphql-php applies this default, so the Input object property is set to null — indistinguishable from an explicitly provided null via get_object_vars.

Fix

bind() now uses ReflectionObject to inspect property types:

  • Old style (public ?int $field) — null is treated as "not provided" and skipped (ReflectionNamedType)
  • New style (public int|null|Undefined $field = Undefined::VALUE) — null is an explicit value and is applied; Undefined::VALUE is skipped (ReflectionUnionType)