Repository navigation
Do not drop request fields whose value is 0, "0" or 0.0 - #907
Merged
Naoray merged 2 commits intoAug 24, 2026
Merged
Conversation
DataTransformer::filterEmptyValues used empty(), which treats the legitimate scalar values 0, "0" and 0.0 as empty, so any top-level payload or query field equal to one of those was silently removed from the outgoing request (e.g. a payment description of "0"). Only null, empty strings and empty arrays are meant to be stripped; check for those cases explicitly instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #906
DataTransformer::filterEmptyValuesused!empty($value) || is_bool($value)to decide which request fields to keep. PHP'sempty()also treats0,"0"and0.0as empty, so those legitimate values were stripped from every outgoing request body and query — e.g. creating a payment withdescription"0"sent no description at all.The intent, per the existing tests, is to remove only
nulland empty strings (booleans were already special-cased). This replaces theempty()check with explicit checks so thatnull,''and[]are still stripped while0,"0",0.0andfalseare preserved:The predicate is shared by both filter sites (the outer payload/query filter and the inner
Arrayablefilter), so this one change covers both — a0-valued field inside anAddress/Moneyobject was affected the same way.Added a regression test asserting that
0,"0"and0.0survive the transform whilenulland''are still removed. It fails onmainand passes with this change; the existing DataTransformer tests are unchanged and still pass.