Make WordPress Core

Changeset 54530

Timestamp:
10/17/2022 11:47:41 AM (22 months ago)
Author:
audrasjb
Message:

Query: Validate relation in WP_Date_Query.

Props dd32, johnjamesjacoby, martinkrcho, ehtis, paulkevan, peterwilsoncc.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-date-query.php

    r54133 r54530  
    151151        }
    152152
    153         if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] ) ) {
    154             $this->relation = 'OR';
     153        if ( isset( $date_query['relation'] ) ) {
     154            $this->relation = ;
    155155        } else {
    156156            $this->relation = 'AND';
     
    220220            $this->validate_date_values( $queries );
    221221        }
     222
     223
     224
    222225
    223226        foreach ( $queries as $key => $q ) {
     
    10421045        return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
    10431046    }
     1047
     1048
     1049
     1050
     1051
     1052
     1053
     1054
     1055
     1056
     1057
     1058
     1059
     1060
     1061
     1062
    10441063}
  • trunk/tests/phpunit/tests/date/query.php

    r54217 r54530  
    11461146        $this->assertSame( array( $p1, $p2 ), $q->posts );
    11471147    }
     1148
     1149
     1150
     1151
     1152
     1153
     1154
     1155
     1156
     1157
     1158
     1159
     1160
     1161
     1162
     1163
     1164
     1165
     1166
     1167
     1168
     1169
     1170
     1171
     1172
     1173
     1174
     1175
     1176
     1177
     1178
     1179
     1180
     1181
     1182
     1183
     1184
     1185
     1186
     1187
     1188
     1189
     1190
     1191
     1192
     1193
     1194
     1195
     1196
     1197
     1198
     1199
     1200
     1201
     1202
     1203
     1204
     1205
     1206
     1207
     1208
     1209
     1210
     1211
     1212
     1213
     1214
     1215
     1216
     1217
     1218
     1219
     1220
     1221
     1222
     1223
     1224
     1225
     1226
     1227
     1228
     1229
     1230
     1231
     1232
     1233
     1234
     1235
     1236
     1237
     1238
     1239
     1240
     1241
     1242
     1243
     1244
     1245
     1246
     1247
     1248
     1249
     1250
     1251
     1252
     1253
     1254
     1255
     1256
     1257
     1258
     1259
     1260
     1261
     1262
     1263
     1264
     1265
     1266
     1267
     1268
     1269
     1270
     1271
     1272
     1273
     1274
     1275
     1276
     1277
     1278
     1279
     1280
     1281
     1282
     1283
     1284
     1285
    11481286}
  • trunk/tests/phpunit/tests/term/taxQuery.php

    r54402 r54530  
    336336    /**
    337337     * @ticket 18105
     338
    338339     */
    339340    public function test_get_sql_relation_and_operator_in() {
     
    382383        $this->assertSame( 3, substr_count( $sql['join'], 'JOIN' ) );
    383384
     385
     386
     387
     388
     389
    384390        _unregister_taxonomy( 'wptests_tax' );
    385391    }
     
    387393    /**
    388394     * @ticket 18105
     395
    389396     */
    390397    public function test_get_sql_nested_relation_or_operator_in() {
     
    435442
    436443        $this->assertSame( 2, substr_count( $sql['join'], 'JOIN' ) );
     444
     445
    437446
    438447        _unregister_taxonomy( 'wptests_tax' );
     
    496505        _unregister_taxonomy( 'wptests_tax' );
    497506    }
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
    498563}
Note: See TracChangeset for help on using the changeset viewer.