From: Ilia Alshanetsky Date: Tue, 20 Nov 2007 14:22:40 +0000 (+0000) Subject: MFB: Fixed bug #42978 (mismatch between number of bound params and values X-Git-Tag: RELEASE_2_0_0a1~1333 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b6cfe903e89ceb9da31711bba432e965962e448;p=php MFB: Fixed bug #42978 (mismatch between number of bound params and values causes a crash in pdo_pgsql) --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index f1059948ae..35cd8a2499 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -144,6 +144,11 @@ static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_typ iterate: if (ht) { + if (zend_hash_num_elements(stmt->bound_param_map) != zend_hash_num_elements(ht)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of bound paramters %d does not match number of bound values %d", zend_hash_num_elements(stmt->bound_param_map), zend_hash_num_elements(ht)); + return 0; + } + zend_hash_internal_pointer_reset(ht); while (SUCCESS == zend_hash_get_current_data(ht, (void**)¶m)) { if (!stmt->methods->param_hook(stmt, param, event_type TSRMLS_CC)) {