From 8b00a2565d6e23681f7c24840f6515023e1ed473 Mon Sep 17 00:00:00 2001 From: mutec Date: Sun, 28 Nov 2021 11:49:39 +0100 Subject: [PATCH] Cast `$length` to an actual `int` in TLengthDatabaseTableColumn::length() When the object is being initialized from the existing structure in the database, the length will be passed as a string and was previously stored as-is within the object. This violates the existing PHPDoc type declaration and breaks consumers that use a strict comparison (`===`) to check the length, notably `YearDatabaseTableColumn`. Fix this by casting the passed parameter to an actual `int`. This should be adjusted to a proper parameter type in a future version. Resolves #4594 [Tim: Adjusted commit message] --- .../database/table/column/TLengthDatabaseTableColumn.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/wcfsetup/install/files/lib/system/database/table/column/TLengthDatabaseTableColumn.class.php b/wcfsetup/install/files/lib/system/database/table/column/TLengthDatabaseTableColumn.class.php index d6b6655f2e..4d36840c3b 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/TLengthDatabaseTableColumn.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/TLengthDatabaseTableColumn.class.php @@ -55,6 +55,7 @@ trait TLengthDatabaseTableColumn { */ public function length($length) { if ($length !== null) { + $length = (int) $length; $this->validateLength($length); } -- 2.20.1