]> granicus.if.org Git - php/commitdiff
Skip field when there is obvious error.
authorYasuo Ohgaki <yohgaki@php.net>
Sat, 19 Oct 2002 04:46:19 +0000 (04:46 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Sat, 19 Oct 2002 04:46:19 +0000 (04:46 +0000)
Fixed freeing of wrong zval.

ext/pgsql/pgsql.c

index cde7b2ba953dab12ebda44d81c3c4438342140b4..48bcc262913164532b6e97b153345f3b320dad60 100644 (file)
@@ -3356,6 +3356,8 @@ PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval
                 zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&val, &pos) == SUCCESS;
                 zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos)) {
                skip_field = 0;
+               MAKE_STD_ZVAL(new_val);
+               
                if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to get array key type");
                        err = 1;
@@ -3391,10 +3393,10 @@ PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval
                        err = 1;
                }
                if (err) {
+                       skip_field = 1; /* prevent adding invalid feild */
                        break;
                }
                
-               MAKE_STD_ZVAL(new_val);
                switch(php_pgsql_get_data_type(Z_STRVAL_PP(type), Z_STRLEN_PP(type)))
                {
                        case PG_BOOL: