diff --git a/NEWS b/NEWS index c26dfd03a19..a28ed64e8c4 100644 --- a/NEWS +++ b/NEWS @@ -3,10 +3,13 @@ PHP NEWS ?? ??? 2022, PHP 8.0.19 - Core: - . Fixed bug GH-8289 (Exceptions thrown within a yielded from iterator are not rethrown into the generator). (Bob) +- MySQLi: + . Fixed bug GH-8267 (MySQLi uses unsupported format specifier on Windows). + (cmb) + 14 Apr 2022, PHP 8.0.18 - Core: diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index 16ed9ddefce..eb74a35697a 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -134,8 +134,6 @@ typedef struct { #ifdef PHP_WIN32 #define PHP_MYSQLI_API __declspec(dllexport) -#define MYSQLI_LLU_SPEC "%I64u" -#define MYSQLI_LL_SPEC "%I64d" #ifndef L64 #define L64(x) x##i64 #endif @@ -146,16 +144,17 @@ typedef __int64 my_longlong; # else # define PHP_MYSQLI_API # endif -/* we need this for PRIu64 and PRId64 */ -#include -#define MYSQLI_LLU_SPEC "%" PRIu64 -#define MYSQLI_LL_SPEC "%" PRId64 #ifndef L64 #define L64(x) x##LL #endif typedef int64_t my_longlong; #endif +/* we need this for PRIu64 and PRId64 */ +#include +#define MYSQLI_LLU_SPEC "%" PRIu64 +#define MYSQLI_LL_SPEC "%" PRId64 + #ifdef ZTS #include "TSRM.h" #endif diff --git a/ext/mysqli/tests/gh8267.phpt b/ext/mysqli/tests/gh8267.phpt new file mode 100644 index 00000000000..204bfbb79ca --- /dev/null +++ b/ext/mysqli/tests/gh8267.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug GH-8267 (MySQLi uses unsupported format specifier on Windows) +--SKIPIF-- + +--FILE-- +query("DROP TABLE IF EXISTS foo"); +$mysqli->query("CREATE TABLE foo (id BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (id))"); +$mysqli->query("INSERT INTO foo VALUES (9223372036854775807)"); +var_dump($mysqli->insert_id); +$mysqli->query("INSERT INTO foo VALUES (0)"); +var_dump($mysqli->insert_id); +?> +--EXPECT-- +string(19) "9223372036854775807" +string(19) "9223372036854775808"