Address WordPress PHPUnit test fails: charset detection, length validation etc#331
Open
chloe-pomegranate wants to merge 1 commit intoWordPress:trunkfrom
Open
Address WordPress PHPUnit test fails: charset detection, length validation etc#331chloe-pomegranate wants to merge 1 commit intoWordPress:trunkfrom
chloe-pomegranate wants to merge 1 commit intoWordPress:trunkfrom
Conversation
…ation, capabilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes (some of) #320 - WordPress PHPUnit test failures related to charset/collation handling, column length validation, and db capabilities
Changes Made
New Methods
get_col_charset($table, $column)- Returns charset for a table column by parsing the Collation field from SHOW FULL COLUMNS outputget_col_length($table, $column)- Returns column length information for validation, supporting char/varchar/binary/varbinary and TEXT/BLOBhas_cap($db_cap)- Reports supported capabilities: collation, group_concat, subqueries, set_charset, utf8mb4, utf8mb4_520, identifier_placeholdersdetermine_charset($charset, $collate)- Upgrades utf8 to utf8mb4 and handles collation mappingExisting Methods Changed
query()- Added strip_invalid_text_from_query() validation to reject queries with invalid data for the column charsetclose()- Properly sets ready=false and has_connected=false when closing the connectionTests
Fixes from the issue:
Other
Haven't touched these ones as they're generally all MySQL specific or SQLite handles them differently:
test_replace- MySQL REPLACE returns affected rows differently than SQLitetest_close- Similar to abovetest_mysqli_flush_sync- MySQL-specific, don't think we can do anything heretest_spatial_indices- SQLite doesn't support SPATIAL KEYtest_wp_update_commenttest_strip_invalid_texttest_set_charset_changes_the_connection_collationNotes
@since 2.3.0- can change to whatever :)