Closed eason9487 closed 1 week ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 65.4%. Comparing base (
0383264
) to head (a29a031
). Report is 4 commits behind head on develop.
Hi @mikkamp, thanks for the review!
Although can you clarify how you are running into the error?
Originally, I haven't reproduced the issue locally either. After changing my local DB to MySQL 8.0.39, I can reproduce it.
So if the error is coming from MySQL I'm just wondering how this is specifically related to WP 6.7 and wouldn't occur in older versions of WP? I'm also not finding anything in WP 6.7 that made these checks stricter.
It was firstly noticed on GitHub Actions. After testing with different combinations of WP and WC versions, the error occurs when using WordPress 6.7-RC3. It won't make the testing fail but only output error messages: https://github.com/woocommerce/google-listings-and-ads/actions/runs/11701884828/job/32588901868#step:6:29
After further research, it appears that WordPress 6.7 changed wp-admin/includes/upgrade.ph
to strict comparison, which might make this comparison produce a different result.
CREATE TABLE `wp_gla_attribute_mapping_rules` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`attribute` varchar(255) NOT NULL,
`source` varchar(100) NOT NULL,
`category_condition_type` varchar(10) NOT NULL,
`categories` text DEFAULT '',
PRIMARY KEY `id` (`id`)
);
In the original loose comparison, the logical comparison matched from the DEFAULT ''
statement in the above table creation SQL will be NULL != ''
, changing it to a strict comparison produces a different result, which is then later executed:
ALTER TABLE wp_gla_attribute_mapping_rules ALTER COLUMN `categories` SET DEFAULT '';
Therefore, I believe this PR could be categorized as a WordPress 6.7 compatibility adjustment.
Thanks for the clarification, that makes sense. I was looking for actual failures in the test runs, but I can see the output mixed in with the test results now.
Changes proposed in this Pull Request:
There are database errors when running PHP Unit Tests with WordPress 6.7-RC3.
Considering the null
categories
will be sanitized to''
before inserting it into database, it may not be an issue to change thecategories
column in thegla_attribute_mapping_rules
table to:https://github.com/woocommerce/google-listings-and-ads/blob/4535b7124ca3ecd256c006945342d3faf983ca85/src/DB/Query/AttributeMappingRulesQuery.php#L42-L44
Screenshots:
📷 Before
📷 After
Detailed test instructions:
Changelog entry