rfc:base_convert_improvements
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:base_convert_improvements [2019/05/23 12:03] – formatting nikic | rfc:base_convert_improvements [2020/08/01 23:53] (current) – RFC was implemented carusogabriel | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2019-05-15 | * Date: 2019-05-15 | ||
* Author: Scott Dutton, | * Author: Scott Dutton, | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
Line 13: | Line 13: | ||
For example base_convert(" | For example base_convert(" | ||
- | Also negative numbers simply do not work, eg base_convert(" | + | Also negative numbers simply do not work, eg base_convert(" |
- | Other functions | + | Experienced developers get caught out by this for example |
+ | |||
+ | In this case literal binary data was the input and the result was 0 (which is expected but not clear) | ||
+ | |||
+ | Other functions | ||
* decbin() - Decimal to binary | * decbin() - Decimal to binary | ||
Line 23: | Line 27: | ||
* dechex() - Decimal to hexadecimal | * dechex() - Decimal to hexadecimal | ||
* hexdec() - Hexadecimal to decimal | * hexdec() - Hexadecimal to decimal | ||
+ | |||
+ | |||
+ | |||
+ | Other programming languages behave in a a similar way to this proposal | ||
+ | * Javascript - https:// | ||
+ | * Python - https:// | ||
+ | * Go - https:// | ||
+ | |||
+ | Javascript does work with larger numbers correctly, Python and Go work in a way which would be similar to PHP if this change was made. | ||
Line 49: | Line 62: | ||
This currently breaks a fair amount of unit tests that I will need to update if this change is accepted. | This currently breaks a fair amount of unit tests that I will need to update if this change is accepted. | ||
- | This issue has been worked around in userland | + | A secondary BC change would be people who have worked around |
https:// | https:// | ||
This change will break these work arounds | This change will break these work arounds | ||
+ | Would suggest PHP8 for this change | ||
Line 83: | Line 98: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | N/A | + | Allow base_convert to allow any length input and not be restricted to a 64 bit int type |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | Include these so readers know where you are heading and can discuss the proposed voting options. | + | 2 votes |
+ | === Error on ignored characters === | ||
+ | This vote will be to raise a E_DEPRECATED warning for PHP 7.4. Raising to be an InvalidArgumentException in PHP 8 | ||
+ | |||
+ | === Allow negative arguments === | ||
+ | This vote will allow negative arguments in PHP 8 | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
https:// | https:// | ||
- | ===== Implementation ===== | ||
- | After the project is implemented, | ||
- | - the version(s) it was merged into | ||
- | - a link to the git commit(s) | ||
- | - a link to the PHP manual entry for the feature | ||
- | - a link to the language specification section (if any) | ||
+ | ===== Vote ===== | ||
+ | Started 19th June 2019. Ends 3rd July 2019 | ||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== References ===== | ===== References ===== | ||
https:// | https:// |
rfc/base_convert_improvements.1558613004.txt.gz · Last modified: 2019/05/23 12:03 by nikic