Conversation
See https://wiki.php.net/rfc/base_convert_improvements Old tests are updated for the depricated error. These will have to be removed for PHP8 ext/standard/tests/math/base_convert_improvements.phpt contains the new tests
There was a problem hiding this comment.
I left some implementation notes. This is the overall structure I'd like to see:
char *s = Z_STRVAL_P(arg);
char *e = s + Z_STRLEN_P(arg);
/* Skip leading whitespace */
while (s < e && isspace(*s)) s++;
/* Skip trailing whitespace */
while (s < e && isspace(*(e-1)) e--;
/* Skip 0x, 0o, 0b prefixes */
if (e - s >= 2) {
if (base == 16 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) s += 2;
// etc
}
/* Main loop */
for (; s < e; s++) {
// etc
}
|
@nikic added the changes suggested. tests passng and added a test case for spaces in the middle with spaces. Not sure if its ok style wise but changed the empty for loop to a while. |
nikic
left a comment
There was a problem hiding this comment.
Thanks for the changes! The implementation side looks good to me now.
There are still some test failures on 32-bit systems: https://dev.azure.com/phpazuredevops/PHP/_build/results?buildId=893&view=ms.vss-test-web.build-test-results-tab (These tests don't run on 64-bit because the maximum integer size affects the output.)
|
Is there an easy way to bless tests for a 32 bit platform ? Assume I will need a 32 bit Vm to do this ? Its easier to bless tests and then check the diff |
|
Merged as d90cdbd. Hopefully I got the merge to master right. Thanks for working on this! |
See https://wiki.php.net/rfc/base_convert_improvements
Old tests are updated for the deprecated error.
These will have to be removed for PHP8
ext/standard/tests/math/base_convert_improvements.phpt contains the new
tests
This takes over from the original PR and contains only the deprecated chars error