@@ -695,7 +695,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
695695 int flags , idx , old_arg_count = 0 ;
696696 zend_class_entry * ce = NULL , * old_ce = NULL ;
697697 zval old_ctor_args = {{0 }, {0 }, {0 }};
698- int i = 0 ;
698+ int column_index_to_fetch = 0 ;
699699 zval * fetch_function_params = NULL ;
700700 uint32_t fetch_function_param_num = 0 ;
701701
@@ -785,7 +785,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
785785 old_arg_count = stmt -> fetch .cls .fci .param_count ;
786786 do_fetch_opt_finish (stmt , 0 );
787787
788- fetch_value (stmt , & val , i ++ , NULL );
788+ fetch_value (stmt , & val , column_index_to_fetch ++ , NULL );
789789 if (Z_TYPE (val ) != IS_NULL ) {
790790 if (!try_convert_to_string (& val )) {
791791 return 0 ;
@@ -865,15 +865,15 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
865865 }
866866
867867 if (group_key ) {
868- fetch_value (stmt , group_key , i , NULL );
868+ fetch_value (stmt , group_key , column_index_to_fetch , NULL );
869869 convert_to_string (group_key );
870- i ++ ;
870+ column_index_to_fetch ++ ;
871871 }
872872
873- for (idx = 0 ; i < stmt -> column_count ; i ++ , idx ++ ) {
873+ for (idx = 0 ; column_index_to_fetch < stmt -> column_count ; column_index_to_fetch ++ , idx ++ ) {
874874 zval val ;
875- fetch_value (stmt , & val , i , NULL );
876- zend_string * column_name = stmt -> columns [i ].name ;
875+ fetch_value (stmt , & val , column_index_to_fetch , NULL );
876+ zend_string * column_name = stmt -> columns [column_index_to_fetch ].name ;
877877
878878 switch (how ) {
879879 case PDO_FETCH_ASSOC :
@@ -883,7 +883,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
883883 case PDO_FETCH_USE_DEFAULT :
884884 case PDO_FETCH_BOTH :
885885 zend_symtable_update (Z_ARRVAL_P (return_value ), column_name , & val );
886- if (zend_hash_index_add (Z_ARRVAL_P (return_value ), i , & val ) != NULL ) {
886+ if (zend_hash_index_add (Z_ARRVAL_P (return_value ), column_index_to_fetch , & val ) != NULL ) {
887887 Z_TRY_ADDREF (val );
888888 }
889889 break ;
0 commit comments