diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php
index 391cfa4..47cab68 100644
|
a
|
b
|
class wpdb { |
| 1000 | 1000 | $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting |
| 1001 | 1001 | $query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware |
| 1002 | 1002 | $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s |
| | 1003 | |
| | 1004 | // START replace NULLs |
| | 1005 | preg_match_all( |
| | 1006 | '#\'?(?:[^%]|^)%(?:(\d+)\$)?[dfs]\'?#', |
| | 1007 | $query, |
| | 1008 | $positions, |
| | 1009 | PREG_OFFSET_CAPTURE |
| | 1010 | ); |
| | 1011 | if ( ! empty( $positions ) ) { |
| | 1012 | $values = array_values( $args ); |
| | 1013 | $index = 0; |
| | 1014 | $str_offset = 0; |
| | 1015 | foreach ( $positions[0] as $ref => $pattern ) { |
| | 1016 | $loc_index = 0; |
| | 1017 | if ( ! empty( $positions[1][$ref] ) ) { |
| | 1018 | $loc_index = ( (int)$positions[1][$ref][0] ) - 1; |
| | 1019 | } else { |
| | 1020 | $loc_index = $index++; |
| | 1021 | } |
| | 1022 | if ( ! isset( $values[$loc_index] ) ) { |
| | 1023 | unset( $values[$loc_index] ); // NULL is not set, but present |
| | 1024 | $format_length = strlen( $pattern[0] ); |
| | 1025 | $query = substr( |
| | 1026 | $query, |
| | 1027 | 0, |
| | 1028 | $pattern[1] + $str_offset |
| | 1029 | ) . ' NULL ' . |
| | 1030 | substr( |
| | 1031 | $query, |
| | 1032 | $pattern[1] + $format_length + $str_offset |
| | 1033 | ); |
| | 1034 | if ( $format_length != 6 ) { |
| | 1035 | $str_offset += 6 - $format_length; |
| | 1036 | } |
| | 1037 | } |
| | 1038 | } |
| | 1039 | $args = array_values( $values ); |
| | 1040 | } |
| | 1041 | // END replace NULLs |
| | 1042 | |
| 1003 | 1043 | array_walk( $args, array( $this, 'escape_by_ref' ) ); |
| 1004 | 1044 | return @vsprintf( $query, $args ); |
| 1005 | 1045 | } |