@@ -72,10 +72,8 @@ PHP_FUNCTION(mysqli_autocommit)
72
72
/* }}} */
73
73
74
74
/* {{{ mysqli_stmt_bind_param_do_bind */
75
- static
76
- int mysqli_stmt_bind_param_do_bind (MY_STMT * stmt , unsigned int num_vars , zval * args , const char * const types , unsigned int num_extra_args )
75
+ static enum_func_status mysqli_stmt_bind_param_do_bind (MY_STMT * stmt , uint32_t num_vars , zval * args , const char * const types , unsigned int arg_num )
77
76
{
78
- unsigned int i ;
79
77
MYSQLND_PARAM_BIND * params ;
80
78
enum_func_status ret = FAIL ;
81
79
@@ -87,7 +85,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a
87
85
if (!params ) {
88
86
goto end ;
89
87
}
90
- for (i = 0 ; i < num_vars ; i ++ ) {
88
+ for (uint32_t i = 0 ; i < num_vars ; i ++ ) {
91
89
uint8_t type ;
92
90
switch (types [i ]) {
93
91
case 'd' : /* Double */
@@ -107,7 +105,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a
107
105
type = MYSQL_TYPE_VAR_STRING ;
108
106
break ;
109
107
default :
110
- zend_argument_value_error (num_extra_args , "must only contain the \"b\", \"d\", \"i\", \"s\" type specifiers" );
108
+ zend_argument_value_error (arg_num , "must only contain the \"b\", \"d\", \"i\", \"s\" type specifiers" );
111
109
ret = FAIL ;
112
110
mysqlnd_stmt_free_param_bind (stmt -> stmt , params );
113
111
goto end ;
@@ -126,7 +124,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a
126
124
PHP_FUNCTION (mysqli_stmt_bind_param )
127
125
{
128
126
zval * args ;
129
- int argc ;
127
+ uint32_t argc ;
130
128
MY_STMT * stmt ;
131
129
zval * mysql_stmt ;
132
130
char * types ;
@@ -154,19 +152,17 @@ PHP_FUNCTION(mysqli_stmt_bind_param)
154
152
RETURN_THROWS ();
155
153
}
156
154
157
- RETVAL_BOOL (! mysqli_stmt_bind_param_do_bind (stmt , argc , args , types , hasThis () ? 1 : 2 ) );
155
+ RETVAL_BOOL (mysqli_stmt_bind_param_do_bind (stmt , argc , args , types , ERROR_ARG_POS ( 2 )) == PASS );
158
156
MYSQLI_REPORT_STMT_ERROR (stmt -> stmt );
159
157
}
160
158
/* }}} */
161
159
162
160
/* {{{ mysqli_stmt_bind_result_do_bind */
163
- static int
164
- mysqli_stmt_bind_result_do_bind (MY_STMT * stmt , zval * args , unsigned int argc )
161
+ static enum_func_status mysqli_stmt_bind_result_do_bind (MY_STMT * stmt , zval * args , uint32_t argc )
165
162
{
166
- unsigned int i ;
167
163
MYSQLND_RESULT_BIND * params = mysqlnd_stmt_alloc_result_bind (stmt -> stmt );
168
164
if (params ) {
169
- for (i = 0 ; i < argc ; i ++ ) {
165
+ for (uint32_t i = 0 ; i < argc ; i ++ ) {
170
166
ZVAL_COPY_VALUE (& params [i ].zv , & args [i ]);
171
167
}
172
168
return mysqlnd_stmt_bind_result (stmt -> stmt , params );
@@ -179,8 +175,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc)
179
175
PHP_FUNCTION (mysqli_stmt_bind_result )
180
176
{
181
177
zval * args ;
182
- int argc ;
183
- zend_ulong rc ;
178
+ uint32_t argc ;
184
179
MY_STMT * stmt ;
185
180
zval * mysql_stmt ;
186
181
@@ -190,13 +185,13 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
190
185
191
186
MYSQLI_FETCH_RESOURCE_STMT (stmt , mysql_stmt , MYSQLI_STATUS_VALID );
192
187
193
- if (( uint32_t ) argc != mysql_stmt_field_count (stmt -> stmt )) {
188
+ if (argc != mysql_stmt_field_count (stmt -> stmt )) {
194
189
zend_argument_count_error ("Number of bind variables doesn't match number of fields in prepared statement" );
195
190
RETURN_THROWS ();
196
191
}
197
192
198
- rc = mysqli_stmt_bind_result_do_bind (stmt , args , argc );
199
- RETURN_BOOL (! rc );
193
+ enum_func_status rc = mysqli_stmt_bind_result_do_bind (stmt , args , argc );
194
+ RETURN_BOOL (rc == PASS );
200
195
}
201
196
/* }}} */
202
197
@@ -207,21 +202,16 @@ PHP_FUNCTION(mysqli_change_user)
207
202
zval * mysql_link = NULL ;
208
203
char * user , * password , * dbname ;
209
204
size_t user_len , password_len , dbname_len ;
210
- zend_ulong rc ;
211
205
212
206
if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Osss!" , & mysql_link , mysqli_link_class_entry , & user , & user_len , & password , & password_len , & dbname , & dbname_len ) == FAILURE ) {
213
207
RETURN_THROWS ();
214
208
}
215
209
MYSQLI_FETCH_RESOURCE_CONN (mysql , mysql_link , MYSQLI_STATUS_VALID );
216
210
217
- rc = mysqlnd_change_user_ex (mysql -> mysql , user , password , dbname , false, (size_t ) password_len );
211
+ enum_func_status rc = mysqlnd_change_user_ex (mysql -> mysql , user , password , dbname , false, (size_t ) password_len );
218
212
MYSQLI_REPORT_MYSQL_ERROR (mysql -> mysql );
219
213
220
- if (rc ) {
221
- RETURN_FALSE ;
222
- }
223
-
224
- RETURN_TRUE ;
214
+ RETURN_BOOL (rc == PASS );
225
215
}
226
216
/* }}} */
227
217
0 commit comments