Skip to content

ext/mysqli: Minor clean-up #15526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/mysqli/mysqli_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a
PHP_FUNCTION(mysqli_stmt_bind_param)
{
zval *args;
int argc;
uint32_t argc;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the signature of mysqli_stmt_bind_param_do_bind be changed too?

Copy link
Member Author

@Girgias Girgias Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this, and changed some more signatures so that it returns enum_func_status, which I think a lot of other functions in mysqli should actually be declared to return instead of int which is not descriptive.

MY_STMT *stmt;
zval *mysql_stmt;
char *types;
Expand Down Expand Up @@ -154,7 +154,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param)
RETURN_THROWS();
}

RETVAL_BOOL(!mysqli_stmt_bind_param_do_bind(stmt, argc, args, types, hasThis() ? 1 : 2));
RETVAL_BOOL(!mysqli_stmt_bind_param_do_bind(stmt, argc, args, types, ERROR_ARG_POS(2)));
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
}
/* }}} */
Expand All @@ -179,7 +179,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc)
PHP_FUNCTION(mysqli_stmt_bind_result)
{
zval *args;
int argc;
uint32_t argc;
zend_ulong rc;
MY_STMT *stmt;
zval *mysql_stmt;
Expand All @@ -190,7 +190,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)

MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);

if ((uint32_t)argc != mysql_stmt_field_count(stmt->stmt)) {
if (argc != mysql_stmt_field_count(stmt->stmt)) {
zend_argument_count_error("Number of bind variables doesn't match number of fields in prepared statement");
RETURN_THROWS();
}
Expand Down
Loading