Ticket #51740: 51740.diff
File 51740.diff, 1.8 KB (added by , 2 years ago) |
---|
-
src/wp-includes/class-wp-meta-query.php
679 679 case 'REGEXP': 680 680 $operator = $meta_compare_key; 681 681 if ( isset( $clause['type_key'] ) && 'BINARY' === strtoupper( $clause['type_key'] ) ) { 682 $cast = 'BINARY'; 682 $cast = 'BINARY'; 683 $meta_key = "CAST($alias.meta_key AS BINARY)"; 683 684 } else { 684 $cast = ''; 685 $cast = ''; 686 $meta_key = "$alias.meta_key"; 685 687 } 686 $where = $wpdb->prepare( "$ alias.meta_key $operator $cast %s", trim( $clause['key'] ) ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared688 $where = $wpdb->prepare( "$meta_key $operator $cast %s", trim( $clause['key'] ) ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 687 689 break; 688 690 689 691 case '!=': … … 705 707 case 'NOT REGEXP': 706 708 $operator = $meta_compare_key; 707 709 if ( isset( $clause['type_key'] ) && 'BINARY' === strtoupper( $clause['type_key'] ) ) { 708 $cast = 'BINARY'; 710 $cast = 'BINARY'; 711 $meta_key = "CAST($subquery_alias.meta_key AS BINARY)"; 709 712 } else { 710 $cast = ''; 713 $cast = ''; 714 $meta_key = "$subquery_alias.meta_key"; 711 715 } 712 716 713 $meta_compare_string = $meta_compare_string_start . "AND $ subquery_alias.meta_key REGEXP $cast %s " . $meta_compare_string_end;717 $meta_compare_string = $meta_compare_string_start . "AND $meta_key REGEXP $cast %s " . $meta_compare_string_end; 714 718 $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 715 719 break; 716 720 }