diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-12-03 23:27:44 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-12-03 23:27:44 +0000 |
commit | 44baca5aedacc17f5a81279ac2c1ef9ba4443376 (patch) | |
tree | 03fd1da06ce5e1e84cb2e494120ec4033dc0c05c /ext/pdo/pdo_sql_parser.re | |
parent | b6bdd449620ed4f92a0bb90c7e1a91a50a74248e (diff) | |
download | php-git-44baca5aedacc17f5a81279ac2c1ef9ba4443376.tar.gz |
Added missing check for mismatching number of tokens & bound params in
prepared statement emulation.
Diffstat (limited to 'ext/pdo/pdo_sql_parser.re')
-rw-r--r-- | ext/pdo/pdo_sql_parser.re | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 2ef69f6748..c6bc1dc5f3 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -132,7 +132,6 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, goto clean_up; } - if (stmt->supports_placeholders == query_type && !stmt->named_rewrite_template) { /* query matches native syntax */ ret = 0; @@ -156,7 +155,13 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, ret = -1; goto clean_up; } - + + if (params && bindno != zend_hash_num_elements(params) && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC); + ret = -1; + goto clean_up; + } + /* what are we going to do ? */ if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { |