Skip to content

Commit

Permalink
Reverted the changes because the array is for internal use only
Browse files Browse the repository at this point in the history
  • Loading branch information
yitam committed Aug 20, 2018
1 parent c445b47 commit f64dcb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions source/pdo_sqlsrv/pdo_dbh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,10 +1396,10 @@ int pdo_sqlsrv_dbh_quote( _Inout_ pdo_dbh_t* dbh, _In_reads_(unquoted_len) const
encoding = driver_dbh->encoding();
}
// get the placeholder at the current position in driver_stmt->placeholders ht
// do not directly alter the internal pointer in the array (See pull request 634 on GitHub)
HashPosition pos;
// Normally it's not a good idea to alter the internal pointer in a hashed array
// (see pull request 634 on GitHub) but in this case this is for internal use only
zval* placeholder = NULL;
if ((placeholder = zend_hash_get_current_data_ex(driver_stmt->placeholders, &pos)) != NULL && zend_hash_move_forward_ex(driver_stmt->placeholders, &pos) == SUCCESS && stmt->bound_params != NULL) {
if ((placeholder = zend_hash_get_current_data(driver_stmt->placeholders)) != NULL && zend_hash_move_forward(driver_stmt->placeholders) == SUCCESS && stmt->bound_params != NULL) {
pdo_bound_param_data* param = NULL;
if (Z_TYPE_P(placeholder) == IS_STRING) {
param = reinterpret_cast<pdo_bound_param_data*>(zend_hash_find_ptr(stmt->bound_params, Z_STR_P(placeholder)));
Expand Down
6 changes: 3 additions & 3 deletions source/pdo_sqlsrv/pdo_stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,10 @@ int pdo_sqlsrv_stmt_execute( _Inout_ pdo_stmt_t *stmt TSRMLS_DC )
// subtituted query provided by PDO
if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
// reset the placeholders hashtable internal in case the user reexecutes a statement
// do not directly alter the internal pointer in the array (See pull request 634 on GitHub)
HashPosition pos;
// Normally it's not a good idea to alter the internal pointer in a hashed array
// (see pull request 634 on GitHub) but in this case this is for internal use only

zend_hash_internal_pointer_reset_ex(driver_stmt->placeholders, &pos);
zend_hash_internal_pointer_reset(driver_stmt->placeholders);

query = stmt->active_query_string;
query_len = static_cast<unsigned int>(stmt->active_query_stringlen);
Expand Down

0 comments on commit f64dcb7

Please sign in to comment.