]> granicus.if.org Git - php/commitdiff
Adjusted fix for bug #42978
authorIlia Alshanetsky <iliaa@php.net>
Tue, 20 Nov 2007 23:12:17 +0000 (23:12 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 20 Nov 2007 23:12:17 +0000 (23:12 +0000)
ext/pdo/pdo_stmt.c
ext/pdo_pgsql/pgsql_statement.c

index d43a0e443c6d18671e05a23a0ee067d303215b1b..35f3232c20d928c7b39964c067211dc749150bd5 100755 (executable)
@@ -168,11 +168,6 @@ 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**)&param)) {
                        if (!stmt->methods->param_hook(stmt, param, event_type TSRMLS_CC)) {
index 0a84bd325892ef0781633d44b671b0238e85ad07..b640974d44addf760c24fd27a576981c9ab20abd 100644 (file)
@@ -265,6 +265,11 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
                                                        sizeof(Oid));
                                }
                                if (param->paramno >= 0) {
+                                       if (param->paramno > zend_hash_num_elements(stmt->bound_param_map)) {
+                                               pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
+                                               return 0;
+                                       }
+
                                        if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB &&
                                                        Z_TYPE_P(param->parameter) == IS_RESOURCE) {
                                                php_stream *stm;