On Mon, Jul 1, 2019 at 4:09 PM Scott Dutton <sc...@exussum.co.uk> wrote:
> Hi all > > I have made a PR for 7.4 for just the ignoring invalid input. I will > open a similar one for PHP 8. > > https://github.com/php/php-src/pull/4328 > > All tests have been fixed for linux, there is one failure for windows > which I am looking in to. > > Voting ends in a few days time so last chance to vote. looks like the > negative number part is not going to pass so the PR has not been > updated. > Link to RFC if you need it - > https://wiki.php.net/rfc/base_convert_improvements > > Any questions please let me know > > Thanks > > Scott > A possibility to consider would to only support negative numbers in bindec, octdec and hexdec. Allowing negative numbers wouldn't change any existing behavior (assuming we consider the leading "-" an error before, as we would per this RFC). The problem is only on the decbin, decoct and dechex side, where we currently treat the input as unsigned. base_convert could also support negative numbers, though it might need some implementation changes (it would be great to make base_convert directly work from string -> string to avoid the float precision loss.) Nikita