Bools Tag values
Closed this issue · 1 comments
Noticed a behavior with passing in a bool as a tag value.
For example: ['is_bot' => false]
and ['is_bot' => true]
The tag gets evaluated to is_bot:
whereas if it's true it's evaluated to is_bot:1
If you concat a string with a bool, this is the same behavior observed in php.
php > echo 'foo' . true;
foo1
php > echo 'foo' . false;
foo
Which is effectively what the function serializeTags() is doing, concatting a string to an unknown type, which with our case it was a bool.
php-datadogstatsd/src/DogStatsd.php
Line 327 in bec0a07
Really this only affects booleans as values, would make sense to just convert true/false to "true"/"false" rather than having them evaluate to 1/null.
I created some test cases and a (potential) fix here master...roippi:boolean_tag_fix
Slapped this together really fast, will PR it after I give it some more consideration and maybe a few more tests :)