diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt index 58108f28f41..d7e255b83a5 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt @@ -31,8 +31,9 @@ require_once('skipifconnectfailure.inc'); if (!is_null($tmp = @$res->fetch_field($link))) printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - while ($tmp = $res->fetch_field()) + while ($tmp = $res->fetch_field()) { var_dump($tmp); + } var_dump($tmp); $res->free_result(); diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt index 563209a2eff..d90248c7165 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt @@ -80,7 +80,7 @@ require_once('skipifconnectfailure.inc'); printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob))) + if (false !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob))) printf("[013] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 3427157617d..f0dca777eb6 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -1373,6 +1373,7 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_parameters)(MYSQLND_STMT * const stmt, /* Prevent from freeing */ /* Don't update is_ref, or we will leak during conversion */ Z_ADDREF_P(stmt->param_bind[i].zv); + stmt->param_bind[i].flags = 0; if (stmt->param_bind[i].type == MYSQL_TYPE_LONG_BLOB) { stmt->param_bind[i].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; } diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index e161f28854c..bafc0ce0645 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -100,8 +100,10 @@ void mysqlnd_res_initialize_result_set_rest(MYSQLND_RES * const result TSRMLS_DC zval **data_begin = result->stored_data->data; unsigned int field_count = result->meta->field_count; unsigned int row_count = result->stored_data->row_count; + DBG_ENTER("mysqlnd_res_initialize_result_set_rest"); + if (!data_cursor || row_count == result->stored_data->initialized_rows) { - return; + DBG_VOID_RETURN; } while ((data_cursor - data_begin) < (row_count * field_count)) { if (NULL == data_cursor[0]) { @@ -128,6 +130,7 @@ void mysqlnd_res_initialize_result_set_rest(MYSQLND_RES * const result TSRMLS_DC } data_cursor += field_count; } + DBG_VOID_RETURN; } /* }}} */ @@ -1752,6 +1755,7 @@ MYSQLND_METHOD(mysqlnd_res, fetch_field)(MYSQLND_RES * const result TSRMLS_DC) not during mysqli_fetch_field() time. */ if (result->stored_data && (result->stored_data->initialized_rows < result->stored_data->row_count)) { + DBG_INF_FMT("We have decode the whole result set to be able to satisfy this meta request"); /* we have to initialize the rest to get the updated max length */ mysqlnd_res_initialize_result_set_rest(result TSRMLS_CC); } @@ -1780,6 +1784,7 @@ MYSQLND_METHOD(mysqlnd_res, fetch_field_direct)(MYSQLND_RES * const result, not during mysqli_fetch_field_direct() time. */ if (result->stored_data && (result->stored_data->initialized_rows < result->stored_data->row_count)) { + DBG_INF_FMT("We have decode the whole result set to be able to satisfy this meta request"); /* we have to initialized the rest to get the updated max length */ mysqlnd_res_initialize_result_set_rest(result TSRMLS_CC); } diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c index 0644b0f09c2..c970749ab6e 100644 --- a/ext/mysqlnd/mysqlnd_result_meta.c +++ b/ext/mysqlnd/mysqlnd_result_meta.c @@ -372,8 +372,12 @@ MYSQLND_METHOD(mysqlnd_res_meta, fetch_field)(MYSQLND_RES_METADATA * const meta { DBG_ENTER("mysqlnd_res_meta::fetch_field"); if (meta->current_field >= meta->field_count) { + DBG_INF("no more fields"); DBG_RETURN(NULL); } + DBG_INF_FMT("name=%s max_length=%u", + meta->fields[meta->current_field].name? meta->fields[meta->current_field].name:"", + meta->fields[meta->current_field].max_length); DBG_RETURN(&meta->fields[meta->current_field++]); } /* }}} */ @@ -386,6 +390,9 @@ MYSQLND_METHOD(mysqlnd_res_meta, fetch_field_direct)(const MYSQLND_RES_METADATA { DBG_ENTER("mysqlnd_res_meta::fetch_field_direct"); DBG_INF_FMT("fieldnr=%d", fieldnr); + DBG_INF_FMT("name=%s max_length=%u", + meta->fields[meta->current_field].name? meta->fields[meta->current_field].name:"", + meta->fields[meta->current_field].max_length); DBG_RETURN(&meta->fields[fieldnr]); } /* }}} */