diff options
author | Sean Bright <elixer@php.net> | 2002-02-10 23:12:57 +0000 |
---|---|---|
committer | Sean Bright <elixer@php.net> | 2002-02-10 23:12:57 +0000 |
commit | cc065b33514a3ef6533de6b5406db954a5f4b9c4 (patch) | |
tree | 97e7d297c33aa7deca321703c50f1919381c7246 /ext/pcre/php_pcre.c | |
parent | 150d339231699945b558a99a6febd6a88a726a11 (diff) | |
download | php-git-cc065b33514a3ef6533de6b5406db954a5f4b9c4.tar.gz |
Fix for bugs #10133 and #15454.
Bug #15454 results from a bug in GMP. If you pass in a string '0xABCD' and
specify a base of 0, GMP figures out that it is hex and skips over the 0x
characters. If you specify base 16, then it doesn't skip those chars.
This was confirmed with the following test program:
#include <stdio.h>
#include <gmp.h>
int main()
{
char *str_one, *str_two;
mpz_t num_one, num_two;
mpz_init_set_str (num_one, "0x45", 0);
str_one = mpz_get_str(NULL, 10, num_one);
mpz_init_set_str (num_two, "0x45", 16);
str_two = mpz_get_str(NULL, 10, num_two);
printf("%s / %s\n", str_one, str_two);
mpz_clear (num_one);
mpz_clear (num_two);
return 0;
}
We now take anything that starts with 0[xX] as hexidecimal and anything
that starts 0[bB] as binary (this is what GMP does internally). We also
no longer force the base to 10 or 16, but instead let GMP decide what the
best base is, be it hex, dec, or octal.
Diffstat (limited to 'ext/pcre/php_pcre.c')
0 files changed, 0 insertions, 0 deletions