diff --git a/Examples/test-suite/php/long_long_runme.php b/Examples/test-suite/php/long_long_runme.php index ac6c2dfb1..544a59c18 100644 --- a/Examples/test-suite/php/long_long_runme.php +++ b/Examples/test-suite/php/long_long_runme.php @@ -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; diff --git a/Lib/php/utils.i b/Lib/php/utils.i index 2ed3532a4..1343495e0 100644 --- a/Lib/php/utils.i +++ b/Lib/php/utils.i @@ -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: