Skip to content

Commit 7763982

Browse files
adamzielclaude
andcommitted
Fix the zero-date CASE expression to compare the function call result, not the raw value
The strtr refactor accidentally changed `WHEN $function_call > '0'` to `WHEN {value} > '0'`, comparing the wrong operand and breaking date validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent be86458 commit 7763982

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

wp-includes/sqlite-ast/class-wp-pdo-mysql-on-sqlite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5701,7 +5701,7 @@ private function cast_value_for_saving(
57015701
WHEN {value} IS NULL THEN NULL
57025702
WHEN {value} IN ('0000-00-00', '0000-00-00 00:00:00') AND NOT {reject_zero_date} THEN {zero_date_value}
57035703
WHEN SUBSTR({value}, 1, 4) != '0000' AND (SUBSTR({value}, 6, 2) = '00' OR SUBSTR({value}, 9, 2) = '00') AND NOT {reject_zero_in_date} THEN {value}
5704-
WHEN {value} > '0' THEN {function_call}
5704+
WHEN {function_call} > '0' THEN {function_call}
57055705
ELSE {fallback}
57065706
END",
57075707
array(

0 commit comments

Comments
 (0)