Skip to content

Commit

Permalink
Merge pull request #2249 from ianbytchek/fix-2111
Browse files Browse the repository at this point in the history
Fix for #2111 – replacing bindParam to bindValue to avoid unexpected reference changes
  • Loading branch information
niden committed Apr 18, 2014
2 parents d761949 + a6d7e82 commit 7051615
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ext/db/adapter/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){
*/
Z_SET_ISREF_P(cast_value);
if (phalcon_compare_strict_long(type, 1024 TSRMLS_CC)) {
PHALCON_CALL_METHOD(NULL, statement, "bindparam", parameter, cast_value);
PHALCON_CALL_METHOD(NULL, statement, "bindvalue", parameter, cast_value);
} else {
PHALCON_CALL_METHOD(NULL, statement, "bindparam", parameter, cast_value, type);
PHALCON_CALL_METHOD(NULL, statement, "bindvalue", parameter, cast_value, type);
}
Z_UNSET_ISREF_P(cast_value);

Expand All @@ -419,7 +419,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){
ZVAL_LONG(type, 2 /* BIND_PARAM_STR */);
}
Z_SET_ISREF_P(value);
PHALCON_CALL_METHOD(NULL, statement, "bindparam", parameter, value, type);
PHALCON_CALL_METHOD(NULL, statement, "bindvalue", parameter, value, type);
Z_UNSET_ISREF_P(value);
/*
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "Invalid bind type parameter");
Expand All @@ -428,7 +428,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){
}
} else {
Z_SET_ISREF_P(value);
PHALCON_CALL_METHOD(NULL, statement, "bindparam", parameter, value);
PHALCON_CALL_METHOD(NULL, statement, "bindvalue", parameter, value);
Z_UNSET_ISREF_P(value);
}

Expand Down

0 comments on commit 7051615

Please sign in to comment.