[php] Fix long long handling on 32 bit platforms
The typemaps for long long and unsigned long long didn't handle a string input correctly, and long_long_runme.php had a flawed test in this case. Fixes #2155
This commit is contained in:
parent
9b10534879
commit
87c2e7d71a
2 changed files with 7 additions and 3 deletions
|
|
@ -21,7 +21,11 @@ function check_ull($ull) {
|
|||
|
||||
check_ll("0");
|
||||
check_ll(0);
|
||||
check_ll(0x7FFFFFFFFFFFFFFF);
|
||||
check_ll("9223372036854775807"); // 0x7FFFFFFFFFFFFFFF
|
||||
if ((int)0x100000000 !== 0) {
|
||||
// This check doesn't work if PHP int is 32 bits.
|
||||
check_ll(0x7FFFFFFFFFFFFFFF);
|
||||
}
|
||||
check_ll(-10);
|
||||
|
||||
$testNumber = 0;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
char * endptr;
|
||||
errno = 0;
|
||||
lvar = (t) strtoll(Z_STRVAL(invar), &endptr, 10);
|
||||
if (*endptr && !errno) break;
|
||||
if (*endptr == '\0' && !errno) break;
|
||||
}
|
||||
/* FALL THRU */
|
||||
default:
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
char * endptr;
|
||||
errno = 0;
|
||||
lvar = (t) strtoull(Z_STRVAL(invar), &endptr, 10);
|
||||
if (*endptr && !errno) break;
|
||||
if (*endptr == '\0' && !errno) break;
|
||||
}
|
||||
/* FALL THRU */
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue