Make WordPress Core

Ticket #60505: 60505.diff

File 60505.diff, 1.3 KB (added by peterwilsoncc, 13 months ago)
  • src/wp-includes/class-wpdb.php

    diff --git a/src/wp-includes/class-wpdb.php b/src/wp-includes/class-wpdb.php
    index d9186b91f4..a9f694e6d4 100644
    a b class wpdb { 
    25932593                        return false;
    25942594                }
    25952595
    2596                 $formats = array();
    2597                 $values  = array();
    2598                 foreach ( $data as $value ) {
     2596                $formats     = array();
     2597                $values      = array();
     2598                $identifiers = array();
     2599                foreach ( $data as $identifier => $value ) {
    25992600                        if ( is_null( $value['value'] ) ) {
    26002601                                $formats[] = 'NULL';
    26012602                                continue;
    26022603                        }
    26032604
    2604                         $formats[] = $value['format'];
    2605                         $values[]  = $value['value'];
     2605                        $formats[]     = $value['format'];
     2606                        $identifiers[] = $identifier;
     2607                        $values[]      = $value['value'];
    26062608                }
    26072609
    2608                 $fields  = '`' . implode( '`, `', array_keys( $data ) ) . '`';
     2610                $fields  = implode( ', ', array_fill( 0, count( $identifiers ), '%i' ) );
    26092611                $formats = implode( ', ', $formats );
    26102612
    2611                 $sql = "$type INTO `$table` ($fields) VALUES ($formats)";
     2613                $sql      = "$type INTO %i ($fields) VALUES ($formats)";
     2614                $prepared = array_merge( array( $table ), $identifiers, $values );
    26122615
    26132616                $this->check_current_query = false;
    2614                 return $this->query( $this->prepare( $sql, $values ) );
     2617                return $this->query( $this->prepare( $sql, $prepared ) );
    26152618        }
    26162619
    26172620        /**