Negative numbers don't coerce to ints
ssandler opened this issue · comments
Scott Sandler commented
=hphpd> =Facebook\TypeCoerce\int('100');
=Facebook\TypeCoerce\int('100');
100
hphpd> =Facebook\TypeCoerce\int('-100');
=Facebook\TypeCoerce\int('-100');
Hit a php exception : exception 'Facebook\TypeAssert\TypeCoercionException' with message 'Could not coerce string to type int' ...
This is due to the use of ctype_digit()
which returns false for negative numbers.