-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Base Convert changes for PHP 7.4 #4328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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