From: mutec Date: Sun, 28 Nov 2021 10:49:39 +0000 (+0100) Subject: Cast `$length` to an actual `int` in TLengthDatabaseTableColumn::length() X-Git-Tag: 5.4.10_dev_1~24^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8b00a2565d6e23681f7c24840f6515023e1ed473;p=GitHub%2FWoltLab%2FWCF.git 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] --- 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); }