Skip to content

Commit 3acdab8

Browse files
committed
Fix printf formats in mysql debug logging
Enable printf format verification and fix the reported errors.
1 parent 3a78259 commit 3acdab8

11 files changed

+95
-82
lines changed

ext/mysqlnd/mysqlnd_auth.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mysqlnd_run_authentication(
107107
conn->authentication_plugin_data.s = mnd_pemalloc(conn->authentication_plugin_data.l, conn->persistent);
108108
memcpy(conn->authentication_plugin_data.s, plugin_data, plugin_data_len);
109109

110-
DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
110+
DBG_INF_FMT("salt(%zu)=[%.*s]", plugin_data_len, (int) plugin_data_len, plugin_data);
111111
/* The data should be allocated with malloc() */
112112
if (auth_plugin) {
113113
scrambled_data = auth_plugin->methods.get_auth_data(
@@ -486,7 +486,7 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
486486
conn->payload_decoder_factory->m.init_ok_packet(&redundant_error_packet);
487487
PACKET_READ(conn, &redundant_error_packet);
488488
PACKET_FREE(&redundant_error_packet);
489-
DBG_INF_FMT("Server is %u, buggy, sends two ERR messages", conn->m->get_server_version(conn));
489+
DBG_INF_FMT("Server is " ZEND_ULONG_FMT ", buggy, sends two ERR messages", conn->m->get_server_version(conn));
490490
}
491491
}
492492
if (ret == PASS) {
@@ -589,7 +589,7 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
589589
if (auth_plugin_data_len < SCRAMBLE_LENGTH) {
590590
/* mysql_native_password only works with SCRAMBLE_LENGTH scramble */
591591
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "The server sent wrong length for scramble");
592-
DBG_ERR_FMT("The server sent wrong length for scramble %u. Expected %u", auth_plugin_data_len, SCRAMBLE_LENGTH);
592+
DBG_ERR_FMT("The server sent wrong length for scramble %zu. Expected %u", auth_plugin_data_len, SCRAMBLE_LENGTH);
593593
DBG_RETURN(NULL);
594594
}
595595

@@ -866,7 +866,7 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
866866
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
867867
break;
868868
}
869-
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet.public_key_len, pk_resp_packet.public_key);
869+
DBG_INF_FMT("Public key(%zu):\n%s", pk_resp_packet.public_key_len, pk_resp_packet.public_key);
870870
/* now extract the public key */
871871
ret = mysqlnd_sha256_get_rsa_from_pem((const char *) pk_resp_packet.public_key, pk_resp_packet.public_key_len);
872872
} while (0);
@@ -889,7 +889,7 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
889889
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
890890
ret = mysqlnd_sha256_get_rsa_from_pem(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
891891
DBG_INF("Successfully loaded");
892-
DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
892+
DBG_INF_FMT("Public key:%*.s", (int) ZSTR_LEN(key_str), ZSTR_VAL(key_str));
893893
zend_string_release_ex(key_str, 0);
894894
}
895895
php_stream_close(stream);
@@ -914,7 +914,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
914914
mysqlnd_rsa_t server_public_key;
915915
zend_uchar * ret = NULL;
916916
DBG_ENTER("mysqlnd_sha256_auth_get_auth_data");
917-
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
917+
DBG_INF_FMT("salt(%zu)=[%.*s]", auth_plugin_data_len, (int) auth_plugin_data_len, auth_plugin_data);
918918

919919

920920
if (conn->vio->data->ssl) {
@@ -1091,12 +1091,12 @@ mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * sel
10911091
{
10921092
zend_uchar * ret = NULL;
10931093
DBG_ENTER("mysqlnd_caching_sha2_get_auth_data");
1094-
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
1094+
DBG_INF_FMT("salt(%zu)=[%.*s]", auth_plugin_data_len, (int) auth_plugin_data_len, auth_plugin_data);
10951095
*auth_data_len = 0;
10961096

10971097
if (auth_plugin_data_len < SCRAMBLE_LENGTH) {
10981098
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "The server sent wrong length for scramble");
1099-
DBG_ERR_FMT("The server sent wrong length for scramble %u. Expected %u", auth_plugin_data_len, SCRAMBLE_LENGTH);
1099+
DBG_ERR_FMT("The server sent wrong length for scramble %zu. Expected %u", auth_plugin_data_len, SCRAMBLE_LENGTH);
11001100
DBG_RETURN(NULL);
11011101
}
11021102

@@ -1107,7 +1107,7 @@ mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * sel
11071107
*auth_data_len = SHA256_LENGTH;
11081108
php_mysqlnd_scramble_sha2((zend_uchar*)ret, auth_plugin_data, (zend_uchar*)passwd, passwd_len);
11091109
ret[SHA256_LENGTH] = '\0';
1110-
DBG_INF_FMT("hash(%d)=[%.*s]", *auth_data_len, *auth_data_len, ret);
1110+
DBG_INF_FMT("hash(%zu)=[%.*s]", *auth_data_len, (int) *auth_data_len, ret);
11111111
}
11121112

11131113
DBG_RETURN(ret);
@@ -1149,7 +1149,7 @@ mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
11491149
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
11501150
break;
11511151
}
1152-
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet.public_key_len, pk_resp_packet.public_key);
1152+
DBG_INF_FMT("Public key(%zu):\n%s", pk_resp_packet.public_key_len, pk_resp_packet.public_key);
11531153
/* now extract the public key */
11541154
ret = mysqlnd_sha256_get_rsa_from_pem((const char *) pk_resp_packet.public_key, pk_resp_packet.public_key_len);
11551155
} while (0);
@@ -1172,7 +1172,7 @@ mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
11721172
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
11731173
ret = mysqlnd_sha256_get_rsa_from_pem(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
11741174
DBG_INF("Successfully loaded");
1175-
DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
1175+
DBG_INF_FMT("Public key: %*.s", (int) ZSTR_LEN(key_str), ZSTR_VAL(key_str));
11761176
zend_string_release(key_str);
11771177
}
11781178
php_stream_close(stream);

ext/mysqlnd/mysqlnd_commands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ MYSQLND_METHOD(mysqlnd_command, handshake)(MYSQLND_CONN_DATA * const conn, const
619619
DBG_ENTER("mysqlnd_command::handshake");
620620

621621
DBG_INF_FMT("stream=%p", conn->vio->data->m.get_stream(conn->vio));
622-
DBG_INF_FMT("[user=%s] [db=%s:%d] [flags=%llu]", user, db, db_len, mysql_flags);
622+
DBG_INF_FMT("[user=%s] [db=%s:%zu] [flags=%zu]", user, db, db_len, mysql_flags);
623623

624624
conn->payload_decoder_factory->m.init_greet_packet(&greet_packet);
625625

ext/mysqlnd/mysqlnd_connection.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static void
337337
MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, dtor)(MYSQLND_CONN_DATA * conn)
338338
{
339339
DBG_ENTER("mysqlnd_conn_data::dtor");
340-
DBG_INF_FMT("conn=%llu", conn->thread_id);
340+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
341341

342342
conn->m->free_contents(conn);
343343
conn->m->free_options(conn);
@@ -765,7 +765,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
765765
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_PCONNECT_SUCCESS, 1, STAT_OPENED_PERSISTENT_CONNECTIONS, 1);
766766
}
767767

768-
DBG_INF_FMT("connection_id=%llu", conn->thread_id);
768+
DBG_INF_FMT("connection_id=%" PRIu64, conn->thread_id);
769769

770770
conn->m->local_tx_end(conn, this_func, PASS);
771771
DBG_RETURN(PASS);
@@ -837,7 +837,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char *
837837
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), query);
838838
enum_func_status ret = FAIL;
839839
DBG_ENTER("mysqlnd_conn_data::query");
840-
DBG_INF_FMT("conn=%p conn=%llu query=%s", conn, conn->thread_id, query);
840+
DBG_INF_FMT("conn=%p conn=%" PRIu64 " query=%s", conn, conn->thread_id, query);
841841

842842
if (PASS == conn->m->local_tx_start(conn, this_func)) {
843843
if (PASS == conn->m->send_query(conn, query, query_len, MYSQLND_SEND_QUERY_IMPLICIT, NULL, NULL) &&
@@ -863,7 +863,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const ch
863863
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), send_query);
864864
enum_func_status ret = FAIL;
865865
DBG_ENTER("mysqlnd_conn_data::send_query");
866-
DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
866+
DBG_INF_FMT("conn=%" PRIu64 " query=%s", conn->thread_id, query);
867867
DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
868868

869869
if (type == MYSQLND_SEND_QUERY_IMPLICIT || PASS == conn->m->local_tx_start(conn, this_func))
@@ -889,7 +889,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn, enum_mys
889889
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), reap_query);
890890
enum_func_status ret = FAIL;
891891
DBG_ENTER("mysqlnd_conn_data::reap_query");
892-
DBG_INF_FMT("conn=%llu", conn->thread_id);
892+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
893893

894894
DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
895895
if (type == MYSQLND_REAP_RESULT_IMPLICIT || PASS == conn->m->local_tx_start(conn, this_func))
@@ -916,7 +916,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, list_method)(MYSQLND_CONN_DATA * conn, const c
916916
MYSQLND_RES * result = NULL;
917917

918918
DBG_ENTER("mysqlnd_conn_data::list_method");
919-
DBG_INF_FMT("conn=%llu query=%s wild=%u", conn->thread_id, query, achtung_wild);
919+
DBG_INF_FMT("conn=%" PRIu64 " query=%s wild=%p", conn->thread_id, query, achtung_wild);
920920

921921
if (PASS == conn->m->local_tx_start(conn, this_func)) {
922922
if (par1) {
@@ -1014,7 +1014,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn,
10141014
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), escape_string);
10151015
zend_ulong ret = FAIL;
10161016
DBG_ENTER("mysqlnd_conn_data::escape_string");
1017-
DBG_INF_FMT("conn=%llu", conn->thread_id);
1017+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
10181018

10191019
if (PASS == conn->m->local_tx_start(conn, this_func)) {
10201020
DBG_INF_FMT("server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
@@ -1037,7 +1037,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, dump_debug_info)(MYSQLND_CONN_DATA * const con
10371037
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), server_dump_debug_information);
10381038
enum_func_status ret = FAIL;
10391039
DBG_ENTER("mysqlnd_conn_data::dump_debug_info");
1040-
DBG_INF_FMT("conn=%llu", conn->thread_id);
1040+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
10411041
if (PASS == conn->m->local_tx_start(conn, this_func)) {
10421042
ret = conn->command->debug(conn);
10431043
conn->m->local_tx_end(conn, this_func, ret);
@@ -1056,7 +1056,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, select_db)(MYSQLND_CONN_DATA * const conn, con
10561056
enum_func_status ret = FAIL;
10571057

10581058
DBG_ENTER("mysqlnd_conn_data::select_db");
1059-
DBG_INF_FMT("conn=%llu db=%s", conn->thread_id, db);
1059+
DBG_INF_FMT("conn=%" PRIu64 " db=%s", conn->thread_id, db);
10601060

10611061
if (PASS == conn->m->local_tx_start(conn, this_func)) {
10621062
const MYSQLND_CSTRING database = {db, db_len};
@@ -1077,7 +1077,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, ping)(MYSQLND_CONN_DATA * const conn)
10771077
enum_func_status ret = FAIL;
10781078

10791079
DBG_ENTER("mysqlnd_conn_data::ping");
1080-
DBG_INF_FMT("conn=%llu", conn->thread_id);
1080+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
10811081

10821082
if (PASS == conn->m->local_tx_start(conn, this_func)) {
10831083
ret = conn->command->ping(conn);
@@ -1097,7 +1097,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_stri
10971097
enum_func_status ret = FAIL;
10981098

10991099
DBG_ENTER("mysqlnd_conn_data::statistic");
1100-
DBG_INF_FMT("conn=%llu", conn->thread_id);
1100+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
11011101

11021102
if (PASS == conn->m->local_tx_start(conn, this_func)) {
11031103
ret = conn->command->statistics(conn, message);
@@ -1116,7 +1116,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, kill)(MYSQLND_CONN_DATA * conn, unsigned int p
11161116
enum_func_status ret = FAIL;
11171117

11181118
DBG_ENTER("mysqlnd_conn_data::kill");
1119-
DBG_INF_FMT("conn=%llu pid=%u", conn->thread_id, pid);
1119+
DBG_INF_FMT("conn=%" PRIu64 " pid=%u", conn->thread_id, pid);
11201120

11211121
if (PASS == conn->m->local_tx_start(conn, this_func)) {
11221122
const unsigned int process_id = pid;
@@ -1140,7 +1140,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_charset)(MYSQLND_CONN_DATA * const conn, c
11401140
const MYSQLND_CHARSET * const charset = mysqlnd_find_charset_name(csname);
11411141

11421142
DBG_ENTER("mysqlnd_conn_data::set_charset");
1143-
DBG_INF_FMT("conn=%llu cs=%s", conn->thread_id, csname);
1143+
DBG_INF_FMT("conn=%" PRIu64 " cs=%s", conn->thread_id, csname);
11441144

11451145
if (!charset) {
11461146
SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Invalid character set was provided");
@@ -1174,7 +1174,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, refresh)(MYSQLND_CONN_DATA * const conn, uint8
11741174
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), refresh_server);
11751175
enum_func_status ret = FAIL;
11761176
DBG_ENTER("mysqlnd_conn_data::refresh");
1177-
DBG_INF_FMT("conn=%llu options=%lu", conn->thread_id, options);
1177+
DBG_INF_FMT("conn=%" PRIu64 " options=%u", conn->thread_id, options);
11781178

11791179
if (PASS == conn->m->local_tx_start(conn, this_func)) {
11801180
ret = conn->command->refresh(conn, options);
@@ -1192,7 +1192,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, shutdown)(MYSQLND_CONN_DATA * const conn, uint
11921192
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), shutdown_server);
11931193
enum_func_status ret = FAIL;
11941194
DBG_ENTER("mysqlnd_conn_data::shutdown");
1195-
DBG_INF_FMT("conn=%llu level=%lu", conn->thread_id, level);
1195+
DBG_INF_FMT("conn=%" PRIu64 " level=%u", conn->thread_id, level);
11961196

11971197
if (PASS == conn->m->local_tx_start(conn, this_func)) {
11981198
ret = conn->command->shutdown(conn, level);
@@ -1213,7 +1213,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn)
12131213
enum mysqlnd_connection_state state = GET_CONNECTION_STATE(&conn->state);
12141214

12151215
DBG_ENTER("mysqlnd_send_close");
1216-
DBG_INF_FMT("conn=%llu vio->data->stream->abstract=%p", conn->thread_id, net_stream? net_stream->abstract:NULL);
1216+
DBG_INF_FMT("conn=%" PRIu64 " vio->data->stream->abstract=%p", conn->thread_id, net_stream? net_stream->abstract:NULL);
12171217
DBG_INF_FMT("state=%u", state);
12181218

12191219
if (state >= CONN_READY) {
@@ -1272,7 +1272,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_reference)(MYSQLND_CONN_DATA * con
12721272
{
12731273
DBG_ENTER("mysqlnd_conn_data::get_reference");
12741274
++conn->refcount;
1275-
DBG_INF_FMT("conn=%llu new_refcount=%u", conn->thread_id, conn->refcount);
1275+
DBG_INF_FMT("conn=%" PRIu64 " new_refcount=%u", conn->thread_id, conn->refcount);
12761276
DBG_RETURN(conn);
12771277
}
12781278
/* }}} */
@@ -1284,7 +1284,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_reference)(MYSQLND_CONN_DATA * co
12841284
{
12851285
enum_func_status ret = PASS;
12861286
DBG_ENTER("mysqlnd_conn_data::free_reference");
1287-
DBG_INF_FMT("conn=%llu old_refcount=%u", conn->thread_id, conn->refcount);
1287+
DBG_INF_FMT("conn=%" PRIu64 " old_refcount=%u", conn->thread_id, conn->refcount);
12881288
if (!(--conn->refcount)) {
12891289
/*
12901290
No multithreading issues as we don't share the connection :)
@@ -1463,7 +1463,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, next_result)(MYSQLND_CONN_DATA * const conn)
14631463
enum_func_status ret = FAIL;
14641464

14651465
DBG_ENTER("mysqlnd_conn_data::next_result");
1466-
DBG_INF_FMT("conn=%llu", conn->thread_id);
1466+
DBG_INF_FMT("conn=%" PRIu64 "", conn->thread_id);
14671467

14681468
if (PASS == conn->m->local_tx_start(conn, this_func)) {
14691469
do {
@@ -1571,7 +1571,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
15711571
enum_func_status ret = FAIL;
15721572

15731573
DBG_ENTER("mysqlnd_conn_data::change_user");
1574-
DBG_INF_FMT("conn=%llu user=%s passwd=%s db=%s silent=%u",
1574+
DBG_INF_FMT("conn=%" PRIu64 " user=%s passwd=%s db=%s silent=%u",
15751575
conn->thread_id, user?user:"", passwd?"***":"null", db?db:"", silent == TRUE);
15761576

15771577
if (PASS != conn->m->local_tx_start(conn, this_func)) {
@@ -1619,7 +1619,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
16191619
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), set_client_option);
16201620
enum_func_status ret = PASS;
16211621
DBG_ENTER("mysqlnd_conn_data::set_client_option");
1622-
DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
1622+
DBG_INF_FMT("conn=%" PRIu64 " option=%u", conn->thread_id, option);
16231623

16241624
if (PASS != conn->m->local_tx_start(conn, this_func)) {
16251625
goto end;
@@ -1786,7 +1786,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons
17861786
const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), set_client_option_2d);
17871787
enum_func_status ret = PASS;
17881788
DBG_ENTER("mysqlnd_conn_data::set_client_option_2d");
1789-
DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
1789+
DBG_INF_FMT("conn=%" PRIu64 " option=%u", conn->thread_id, option);
17901790

17911791
if (PASS != conn->m->local_tx_start(conn, this_func)) {
17921792
goto end;
@@ -1835,7 +1835,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, use_result)(MYSQLND_CONN_DATA * const conn)
18351835
MYSQLND_RES * result = NULL;
18361836

18371837
DBG_ENTER("mysqlnd_conn_data::use_result");
1838-
DBG_INF_FMT("conn=%llu", conn->thread_id);
1838+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
18391839

18401840
if (PASS == conn->m->local_tx_start(conn, this_func)) {
18411841
do {
@@ -1877,7 +1877,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn)
18771877
MYSQLND_RES * result = NULL;
18781878

18791879
DBG_ENTER("mysqlnd_conn_data::store_result");
1880-
DBG_INF_FMT("conn=%llu conn=%p", conn->thread_id, conn);
1880+
DBG_INF_FMT("conn=%" PRIu64 " conn=%p", conn->thread_id, conn);
18811881

18821882
if (PASS == conn->m->local_tx_start(conn, this_func)) {
18831883
do {
@@ -2363,7 +2363,7 @@ static void
23632363
MYSQLND_METHOD_PRIVATE(mysqlnd_conn, dtor)(MYSQLND * conn)
23642364
{
23652365
DBG_ENTER("mysqlnd_conn::dtor");
2366-
DBG_INF_FMT("conn=%llu", conn->data->thread_id);
2366+
DBG_INF_FMT("conn=%" PRIu64, conn->data->thread_id);
23672367

23682368
conn->data->m->free_reference(conn->data);
23692369

@@ -2383,7 +2383,7 @@ MYSQLND_METHOD(mysqlnd_conn, close)(MYSQLND * conn_handle, const enum_connection
23832383
enum_func_status ret = FAIL;
23842384

23852385
DBG_ENTER("mysqlnd_conn::close");
2386-
DBG_INF_FMT("conn=%llu", conn->thread_id);
2386+
DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
23872387

23882388
if (PASS == conn->m->local_tx_start(conn, this_func)) {
23892389
if (GET_CONNECTION_STATE(&conn->state) >= CONN_READY) {
@@ -2475,7 +2475,7 @@ mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t
24752475
* is not displayed.
24762476
* */
24772477
stream = (*p)->data->vio->data->m.get_stream((*p)->data->vio);
2478-
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream);
2478+
DBG_INF_FMT("conn=%" PRIu64 " stream=%p", (*p)->data->thread_id, stream);
24792479
if (stream != NULL &&
24802480
SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) &&
24812481
ZEND_VALID_SOCKET(this_fd))
@@ -2508,7 +2508,7 @@ mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds)
25082508

25092509
while (*fwd) {
25102510
stream = (*fwd)->data->vio->data->m.get_stream((*fwd)->data->vio);
2511-
DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, stream);
2511+
DBG_INF_FMT("conn=%" PRIu64 " stream=%p", (*fwd)->data->thread_id, stream);
25122512
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
25132513
(void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
25142514
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {

ext/mysqlnd/mysqlnd_debug.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,19 @@ MYSQLND_METHOD(mysqlnd_debug, close)(MYSQLND_DEBUG * self)
432432
"number of functions: %d", zend_hash_num_elements(&self->function_profiles));
433433
ZEND_HASH_FOREACH_STR_KEY_PTR(&self->function_profiles, string_key, f_profile) {
434434
self->m->log_va(self, __LINE__, __FILE__, -1, "info : ",
435-
"%-40s\tcalls=%5llu own_slow=%5llu in_calls_slow=%5llu total_slow=%5llu"
436-
" min_own=%5llu max_own=%7llu avg_own=%7llu "
437-
" min_in_calls=%5llu max_in_calls=%7llu avg_in_calls=%7llu"
438-
" min_total=%5llu max_total=%7llu avg_total=%7llu"
435+
"%-40s\tcalls=%5" PRIu64
436+
" own_slow=%5" PRIu64
437+
" in_calls_slow=%5" PRIu64
438+
" total_slow=%5" PRIu64
439+
" min_own=%5" PRIu64
440+
" max_own=%7" PRIu64
441+
" avg_own=%7" PRIu64
442+
" min_in_calls=%5" PRIu64
443+
" max_in_calls=%7" PRIu64
444+
" avg_in_calls=%7" PRIu64
445+
" min_total=%5" PRIu64
446+
" max_total=%7" PRIu64
447+
" avg_total=%7" PRIu64
439448
,ZSTR_VAL(string_key)
440449
,(uint64_t) f_profile->calls
441450
,(uint64_t) f_profile->own_underporm_calls

0 commit comments

Comments
 (0)