Skip to content

Backport: Fix ObjectEncoder dropping attributes with falsy values#62

Merged
veewee merged 2 commits into0.31.xfrom
fix/falsy-attribute-encoding-0.31.x
Apr 21, 2026
Merged

Backport: Fix ObjectEncoder dropping attributes with falsy values#62
veewee merged 2 commits into0.31.xfrom
fix/falsy-attribute-encoding-0.31.x

Conversation

@veewee
Copy link
Copy Markdown
Member

@veewee veewee commented Apr 21, 2026

Backports the fix from #60 to the 0.31.x branch, so a 0.31.1 patch release can be tagged for projects still on PHP 8.3 that cannot upgrade to 0.32.x (which raised the minimum PHP version to 8.4 and bumped several dependencies).

Closes #61.

Credit to @ademarco for the original backport patch (openeuropa#1).

Changes

  • One-line fix in ObjectEncoder.php: use $value !== null instead of a truthy check, so falsy attribute values (false, 0, 0.0, "") are still encoded.
  • Test coverage for falsy attribute values.

Test plan

  • vendor/bin/phpunit passes locally (564 tests, 1156 assertions)

@veewee veewee merged commit aee9e1f into 0.31.x Apr 21, 2026
31 checks passed
@veewee veewee deleted the fix/falsy-attribute-encoding-0.31.x branch April 21, 2026 09:19
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.

2 participants