From 6ba4f4203c3d9e84c8d96f7f94a06509275c2ecb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 19:48:05 +0000 Subject: [PATCH 1/5] Initial plan From db3f82acd09119e77d848bf5c994b544eb97dbf3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 20:14:01 +0000 Subject: [PATCH 2/5] Fix bad-string-token to return null for get_token_value() per CSS spec Agent-Logs-Url: https://github.com/WordPress/php-toolkit/sessions/9495c227-9aa5-42a7-a775-637972682f45 Co-authored-by: sirreal <841763+sirreal@users.noreply.github.com> --- .../DataLiberation/CSS/class-cssprocessor.php | 7 +++++-- .../DataLiberation/Tests/CSSProcessorTest.php | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/components/DataLiberation/CSS/class-cssprocessor.php b/components/DataLiberation/CSS/class-cssprocessor.php index cacb48b4..4f7edf54 100644 --- a/components/DataLiberation/CSS/class-cssprocessor.php +++ b/components/DataLiberation/CSS/class-cssprocessor.php @@ -699,7 +699,6 @@ public function get_token_value() { break; case self::TOKEN_STRING: - case self::TOKEN_BAD_STRING: case self::TOKEN_URL: // Decode and cache the string/URL value. if ( null !== $this->token_value_starts_at && null !== $this->token_value_length ) { @@ -707,12 +706,16 @@ public function get_token_value() { $this->token_value_starts_at, $this->token_value_length ); - $this->token_value = $this->token_value; } else { $this->token_value = null; } break; + case self::TOKEN_BAD_STRING: + // Bad-string-token has no associated value per the CSS spec. + $this->token_value = null; + break; + case self::TOKEN_DELIM: // Delim value is the single code point. $this->token_value = $this->decode_string_or_url( $this->token_starts_at, $this->token_length ); diff --git a/components/DataLiberation/Tests/CSSProcessorTest.php b/components/DataLiberation/Tests/CSSProcessorTest.php index ed164ac2..a6f7f7f3 100644 --- a/components/DataLiberation/Tests/CSSProcessorTest.php +++ b/components/DataLiberation/Tests/CSSProcessorTest.php @@ -1541,4 +1541,19 @@ public function test_ident_start_codepoint_bounds_check(): void { ); $this->assertSame( $expected_tokens, $actual_tokens ); } + + /** + * Tests that bad-string-token returns null for get_token_value(). + * + * Per the CSS spec, bad-string-token has no associated data. + * + * @see https://www.w3.org/TR/css-syntax-3/#tokenization + */ + public function test_bad_string_token_value_is_null(): void { + // A bad-string-token is produced when a string is broken by a newline. + $processor = CSSProcessor::create( "'str\ning'" ); + $processor->next_token(); + $this->assertSame( CSSProcessor::TOKEN_BAD_STRING, $processor->get_token_type() ); + $this->assertNull( $processor->get_token_value() ); + } } From 4f578787d86be3431ede239bb355b216eb62dd2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 07:42:59 +0000 Subject: [PATCH 3/5] Remove redundant TOKEN_BAD_STRING case, rely on default Agent-Logs-Url: https://github.com/WordPress/php-toolkit/sessions/0755505c-db76-4bf1-88e5-73187e0e5844 Co-authored-by: sirreal <841763+sirreal@users.noreply.github.com> --- components/DataLiberation/CSS/class-cssprocessor.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/DataLiberation/CSS/class-cssprocessor.php b/components/DataLiberation/CSS/class-cssprocessor.php index 4f7edf54..c126c040 100644 --- a/components/DataLiberation/CSS/class-cssprocessor.php +++ b/components/DataLiberation/CSS/class-cssprocessor.php @@ -711,11 +711,6 @@ public function get_token_value() { } break; - case self::TOKEN_BAD_STRING: - // Bad-string-token has no associated value per the CSS spec. - $this->token_value = null; - break; - case self::TOKEN_DELIM: // Delim value is the single code point. $this->token_value = $this->decode_string_or_url( $this->token_starts_at, $this->token_length ); From 1cc2e56b2f292d310af68bf8d4dc82318ce60e19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 07:59:27 +0000 Subject: [PATCH 4/5] Update stale @see URL in get_token_value() docblock Agent-Logs-Url: https://github.com/WordPress/php-toolkit/sessions/510568bd-b504-4a43-aa67-b0328a877712 Co-authored-by: sirreal <841763+sirreal@users.noreply.github.com> --- components/DataLiberation/CSS/class-cssprocessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/DataLiberation/CSS/class-cssprocessor.php b/components/DataLiberation/CSS/class-cssprocessor.php index c126c040..e7f50adb 100644 --- a/components/DataLiberation/CSS/class-cssprocessor.php +++ b/components/DataLiberation/CSS/class-cssprocessor.php @@ -668,7 +668,7 @@ public function get_unnormalized_token(): ?string { * - For strings/URLs: the decoded string value * - For other tokens: null * - * @see https://www.w3.org/TR/css-syntax-3/#token-value + * @see https://www.w3.org/TR/css-syntax-3/#tokenization * @return string|null */ public function get_token_value() { From 4382fe08a7f1614a71e49cd485b34dc64a609b8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 09:46:16 +0000 Subject: [PATCH 5/5] Fix css-test-cases.json: set bad-string-token values to null per CSS spec Agent-Logs-Url: https://github.com/WordPress/php-toolkit/sessions/b19022f3-8e8f-4077-bf0b-1c7ad26425c0 Co-authored-by: sirreal <841763+sirreal@users.noreply.github.com> --- components/DataLiberation/Tests/css-test-cases.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/DataLiberation/Tests/css-test-cases.json b/components/DataLiberation/Tests/css-test-cases.json index a1c10081..c1ead99f 100644 --- a/components/DataLiberation/Tests/css-test-cases.json +++ b/components/DataLiberation/Tests/css-test-cases.json @@ -237,7 +237,7 @@ "startIndex": 0, "endIndex": 4, "normalized": "\"foo", - "value": "foo" + "value": null }, { "type": "whitespace-token", @@ -253,7 +253,7 @@ "startIndex": 5, "endIndex": 6, "normalized": "\"", - "value": "" + "value": null }, { "type": "whitespace-token", @@ -295,7 +295,7 @@ "startIndex": 0, "endIndex": 4, "normalized": "\"foo", - "value": "foo" + "value": null }, { "type": "whitespace-token", @@ -311,7 +311,7 @@ "startIndex": 6, "endIndex": 7, "normalized": "\"", - "value": "" + "value": null }, { "type": "whitespace-token", @@ -353,7 +353,7 @@ "startIndex": 0, "endIndex": 7, "normalized": "\"aa𐀀", - "value": "aa𐀀" + "value": null }, { "type": "whitespace-token", @@ -4251,7 +4251,7 @@ "startIndex": 0, "endIndex": 3, "normalized": "\"fo", - "value": "fo" + "value": null }, { "type": "whitespace-token",