Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-8267: MySQLi uses unsupported format specifier on Windows
This commit is contained in:
Christoph M. Becker 2022-04-07 17:04:22 +02:00
commit 22f8886038
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
3 changed files with 33 additions and 7 deletions

6
NEWS
View File

@ -17,7 +17,11 @@ PHP NEWS
- Hash:
. Fixed bug #81714 (segfault when serializing finalized HashContext). (cmb)
31 Mar 2022, PHP 8.1.5
- MySQLi:
. Fixed bug GH-8267 (MySQLi uses unsupported format specifier on Windows).
(cmb)
14 Apr 2022, PHP 8.1.5
- Core:
. Fixed bug GH-8176 (Enum values in property initializers leak). (Bob)

View File

@ -127,8 +127,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
@ -139,16 +137,17 @@ typedef __int64 my_longlong;
# else
# define PHP_MYSQLI_API
# endif
/* we need this for PRIu64 and PRId64 */
#include <inttypes.h>
#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 <inttypes.h>
#define MYSQLI_LLU_SPEC "%" PRIu64
#define MYSQLI_LL_SPEC "%" PRId64
#ifdef ZTS
#include "TSRM.h"
#endif

View File

@ -0,0 +1,23 @@
--TEST--
Bug GH-8267 (MySQLi uses unsupported format specifier on Windows)
--EXTENSIONS--
mysqli
--SKIPIF--
<?php
require_once("skipifconnectfailure.inc");
?>
--FILE--
<?php
require_once("connect.inc");
$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$mysqli->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"