-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Ensure correct default value normalization
Default value support for TEXT, JSON and BLOB fields has been added with #103578 by implementing the use of default value expression for MySQL. That required to add custom normalization on data schema reads to be comparable. MySQL requires to use a single-quote to quote a single quote in a value string, and due to the expression way this needs to be properly decoded now in two steps: * Revert escape sequences in the retrieved default value * Unquote the unescaped retrieved default value JSON field defaults shows a similar issue for double quotes in the json value and can be fixed in the same way. Added test revealed, that Doctrine DBAL has an issue with double single-quotes for PostgreSQL too. To fix this the issue has been reported [1] and a pull-request provided [2]. This change ensure correct unescaping and unquoting of the retrieved column default value for TEXT, JSON and BLOB column types for MySQL connections, enriched with further tests. The extended PostreSQLSchemaManager now clones method `_getPortableTableColumnDefinition()` to incorporate the bugfix directly until a fixed Doctrine DBAL version has been released. [1] doctrine/dbal#6357 [2] doctrine/dbal#6358 Resolves: #103610 Related: #103578 Releases: main Change-Id: Icb39cdb8c87ae7907f84e5c38adcde4ef545ed1b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83745 Tested-by: Stefan Bürk <[email protected]> Tested-by: Garvin Hicking <[email protected]> Reviewed-by: Christian Kuhn <[email protected]> Reviewed-by: Stefan Bürk <[email protected]> Reviewed-by: Garvin Hicking <[email protected]> Tested-by: core-ci <[email protected]> Tested-by: Christian Kuhn <[email protected]>
- Loading branch information
Showing
10 changed files
with
281 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
3 changes: 3 additions & 0 deletions
3
...faultValue/Assertions/json-not-null-default-data-object-value-with-double-quote-value.csv
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"a_textfield_test_table", | ||
,"uid","pid","testfield", | ||
,1,0,"{""key1"": ""value1"", ""key2"": 123, ""key3"": ""value with a \" double quote""}", |
3 changes: 3 additions & 0 deletions
3
...faultValue/Assertions/json-not-null-default-data-object-value-with-single-quote-value.csv
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"a_textfield_test_table", | ||
,"uid","pid","testfield", | ||
,1,0,"{""key1"": ""value1"", ""key2"": 123, ""key3"": ""value with a ' single quote""}", |
9 changes: 9 additions & 0 deletions
9
...JsonFieldDefaultValue/json-not-null-default-data-object-value-with-double-quote-value.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE a_textfield_test_table | ||
( | ||
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
pid INT(11) UNSIGNED DEFAULT '0' NOT NULL, | ||
testfield JSON NOT NULL DEFAULT '{"key1": "value1", "key2": 123, "key3": "value with a \" double quote"}', | ||
|
||
PRIMARY KEY (uid), | ||
KEY parent (pid) | ||
); |
9 changes: 9 additions & 0 deletions
9
...JsonFieldDefaultValue/json-not-null-default-data-object-value-with-single-quote-value.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE a_textfield_test_table | ||
( | ||
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
pid INT(11) UNSIGNED DEFAULT '0' NOT NULL, | ||
testfield JSON NOT NULL DEFAULT '{"key1": "value1", "key2": 123, "key3": "value with a '' single quote"}', | ||
|
||
PRIMARY KEY (uid), | ||
KEY parent (pid) | ||
); |
3 changes: 3 additions & 0 deletions
3
...eldDefaultValue/Assertions/text-not-null-default-value-string-with-single-quote-value.csv
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"a_textfield_test_table", | ||
,"uid","pid","testfield", | ||
,1,0,"default-value with a single ' quote", |
9 changes: 9 additions & 0 deletions
9
...ures/TextFieldDefaultValue/text-not-null-default-value-string-with-single-quote-value.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE a_textfield_test_table | ||
( | ||
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
pid INT(11) UNSIGNED DEFAULT '0' NOT NULL, | ||
testfield TEXT NOT NULL DEFAULT 'default-value with a single '' quote', | ||
|
||
PRIMARY KEY (uid), | ||
KEY parent (pid) | ||
); |
This file contains 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