@@ -977,7 +977,7 @@ PHP_FUNCTION(odbc_execute)
977
977
int i , ne ;
978
978
RETCODE rc ;
979
979
980
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "r|h/ " , & pv_res , & pv_param_ht ) == FAILURE ) {
980
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "r|h" , & pv_res , & pv_param_ht ) == FAILURE ) {
981
981
RETURN_THROWS ();
982
982
}
983
983
@@ -991,25 +991,13 @@ PHP_FUNCTION(odbc_execute)
991
991
RETURN_FALSE ;
992
992
}
993
993
994
- zend_hash_internal_pointer_reset (pv_param_ht );
995
994
params = (params_t * )safe_emalloc (sizeof (params_t ), result -> numparams , 0 );
996
995
for (i = 0 ; i < result -> numparams ; i ++ ) {
997
996
params [i ].fp = -1 ;
998
997
}
999
998
1000
- for (i = 1 ; i <= result -> numparams ; i ++ ) {
1001
- if ((tmp = zend_hash_get_current_data (pv_param_ht )) == NULL ) {
1002
- php_error_docref (NULL , E_WARNING ,"Error getting parameter" );
1003
- SQLFreeStmt (result -> stmt ,SQL_RESET_PARAMS );
1004
- for (i = 0 ; i < result -> numparams ; i ++ ) {
1005
- if (params [i ].fp != -1 ) {
1006
- close (params [i ].fp );
1007
- }
1008
- }
1009
- efree (params );
1010
- RETURN_FALSE ;
1011
- }
1012
-
999
+ i = 1 ;
1000
+ ZEND_HASH_FOREACH_VAL (pv_param_ht , tmp ) {
1013
1001
otype = Z_TYPE_P (tmp );
1014
1002
if (!try_convert_to_string (tmp )) {
1015
1003
SQLFreeStmt (result -> stmt , SQL_RESET_PARAMS );
@@ -1099,8 +1087,8 @@ PHP_FUNCTION(odbc_execute)
1099
1087
efree (params );
1100
1088
RETURN_FALSE ;
1101
1089
}
1102
- zend_hash_move_forward ( pv_param_ht ) ;
1103
- }
1090
+ if ( i ++ > result -> numparams ) break ;
1091
+ } ZEND_HASH_FOREACH_END ();
1104
1092
}
1105
1093
/* Close cursor, needed for doing multiple selects */
1106
1094
rc = SQLFreeStmt (result -> stmt , SQL_CLOSE );
0 commit comments