#51740 closed defect (bug) (fixed)
Test failures using MySQL 8
Reported by: | desrosj | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Database | Keywords: | has-patch |
Focuses: | Cc: |
Description
I was doing some experimenting adding multiple MySQL versions to the GitHub Action workflow matrix, and noticed that there are 4 test failures in the local Docker environment when running MySQL 8.
1) Tests_dbDelta::test_wp_get_db_schema_does_no_alter_queries_on_existing_install Failed asserting that an array is empty. /var/www/tests/phpunit/tests/dbdelta.php:711 2) Tests_Meta_Query::test_meta_type_key_should_be_passed_to_meta_query Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 0 => 1424 -) +Array &0 () /var/www/tests/phpunit/includes/abstract-testcase.php:704 /var/www/tests/phpunit/tests/meta/query.php:775 3) Tests_Query_MetaQuery::test_compare_key_regexp_rlike Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 0 => 36059 -) +Array &0 () /var/www/tests/phpunit/includes/abstract-testcase.php:704 /var/www/tests/phpunit/tests/query/metaQuery.php:2126 4) Tests_Query_MetaQuery::test_compare_key_not_regexp Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 0 => 36063 - 1 => 36064 -) +Array &0 () /var/www/tests/phpunit/includes/abstract-testcase.php:704 /var/www/tests/phpunit/tests/query/metaQuery.php:2169
I haven't looked into the failures yet, but I added some var_dumps()
to help debugging.
Attachments (1)
Change History (16)
#3
@
4 years ago
- Milestone changed from Future Release to 5.9
I'd like to solve the MySQL 8 test failures for 5.9 to that we can look at expanding our testing combinations.
#4
@
3 years ago
- Milestone changed from 5.9 to 6.0
5.9 Beta 1 is in 4 days. Like the other MySQL 8.0 tickets, moving to 6.0.
This ticket was mentioned in Slack in #core by costdev. View the logs.
3 years ago
#6
@
3 years ago
- Milestone changed from 6.0 to Future Release
I'm moving this to a future release as RC 1 is approaching in a few days.
#8
@
2 years ago
Some more context on the remaining three failures:
2) Tests_Meta_Query::test_meta_type_key_should_be_passed_to_meta_query Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 0 => 1424 -) +Array &0 () /var/www/tests/phpunit/includes/abstract-testcase.php:704 /var/www/tests/phpunit/tests/meta/query.php:775
caused by:
WordPress database error Character set 'utf8mb4_unicode_520_ci' cannot be used in conjunction with 'binary' in call to regexp_like. for query SELECT SQL_CALC_FOUND_ROWS wptests_posts.ID FROM wptests_posts INNER JOIN wptests_postmeta ON ( wptests_posts.ID = wptests_postmeta.post_id ) WHERE 1=1 AND ( wptests_postmeta.meta_key REGEXP BINARY 'AAA_FOO_.*' ) AND ((wptests_posts.post_type = 'post' AND (wptests_posts.post_status = 'publish'))) GROUP BY wptests_posts.ID ORDER BY wptests_posts.post_date DESC LIMIT 0, 10
3) Tests_Query_MetaQuery::test_compare_key_regexp_rlike Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 0 => 36059 -) +Array &0 () /var/www/tests/phpunit/includes/abstract-testcase.php:704 /var/www/tests/phpunit/tests/query/metaQuery.php:2126
caused by:
WordPress database error Character set 'utf8mb4_unicode_520_ci' cannot be used in conjunction with 'binary' in call to regexp_like. for query SELECT SQL_CALC_FOUND_ROWS wptests_posts.ID FROM wptests_posts INNER JOIN wptests_postmeta ON ( wptests_posts.ID = wptests_postmeta.post_id ) WHERE 1=1 AND ( wptests_postmeta.meta_key RLIKE BINARY 'AAA_FOO_.*' ) AND ((wptests_posts.post_type = 'post' AND (wptests_posts.post_status = 'publish'))) GROUP BY wptests_posts.ID ORDER BY wptests_posts.post_date DESC LIMIT 0, 10
4) Tests_Query_MetaQuery::test_compare_key_not_regexp Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 0 => 36063 - 1 => 36064 -) +Array &0 () /var/www/tests/phpunit/includes/abstract-testcase.php:704 /var/www/tests/phpunit/tests/query/metaQuery.php:2169
caused by:
WordPress database error Character set 'utf8mb4_unicode_520_ci' cannot be used in conjunction with 'binary' in call to regexp_like. for query SELECT SQL_CALC_FOUND_ROWS wptests_posts.ID FROM wptests_posts INNER JOIN wptests_postmeta ON ( wptests_posts.ID = wptests_postmeta.post_id ) WHERE 1=1 AND ( NOT EXISTS (SELECT 1 FROM wptests_postmeta mt1 WHERE mt1.post_ID = wptests_postmeta.post_ID AND mt1.meta_key REGEXP BINARY 'AAA_FOO_.*' LIMIT 1) ) AND ((wptests_posts.post_type = 'post' AND (wptests_posts.post_status = 'publish'))) GROUP BY wptests_posts.ID ORDER BY wptests_posts.post_date DESC LIMIT 0, 10
#9
@
2 years ago
Seems to be related to Bug #104387 CHARACTER_SET_MISMATCH issue with regex comparisons.
From the MySQL 8.0.22 changelog:
Regular expression functions such as
REGEXP_LIKE()
yielded inconsistent results with binary string arguments. These functions now reject binary strings with an error. (Bug #98951, Bug #98950)
#10
@
2 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 6.1
51740.diff resolves the remaining failures in my testing.
Tested with MySQL 8.0.30 and MariaDB 10.6.8.
Related to the first failure: #49364.
Previously: #44384, #49344.