Bug #87593

Install Tool > Wizard > Update sys_language records to use the newly sorting column

Added by Michael Staatz 10 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Install Tool
Target version:
-
Start date:
2019-01-31
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Hi all,

the Upgrade Wizard "Update sys_language records to use the newly sorting column" is iterating over the entries at table "sys_language". In our case there are 27 entries in that table.

Here is the code fragment from executeUpdate function :

$sortCounter = 128;
while ($languageRecord = $statement->fetch()) {
    // your code goes here

    $sortCounter *= 2;    
}

$sortCounter is to large for an INT (11) in the Database in our case. Which result in following error message:

Doctrine\DBAL\Exception\DriverException
An exception occurred while executing ‘UPDATE `sys_language` SET `sorting` = ? WHERE `uid` = ?’ with params [2147483648, 14]: Out of range value for column ‘sorting’ at row 1

When i initialize $sortCounter with a lower value, fx:

$sortCounter = 2;

all went fine.

Little Test Code to show the Value:

<?php
$x = 128;
for ($i = 1; $i <= 28; $i++) {
    $x *= 2;
};
var_dump($x);
// Result => 34359738368

Best,
Michael

Associated revisions

Revision a527e83b (diff)
Added by Markus Klein 9 months ago

[BUGFIX] Prevent int range escalation in language sorting

The upgrade wizard to set a proper sorting for sys_language records
leaves a gap between the numbers to void necessary re-numbering
of the sorting field upon sorting changes.
This gap is changed to grow only linear instead of exponential.

Releases: 9.5,8.7
Resolves: #87593
Change-Id: If9b62f2fc3c449c883c6d1512084e306b3525b7e
Reviewed-on: https://review.typo3.org/c/59772
Reviewed-by: Benni Mack <>
Reviewed-by: Oliver Klee <>
Reviewed-by: Johannes Kasberger <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Georg Ringer <>
Tested-by: TYPO3com <>
Tested-by: Johannes Kasberger <>
Tested-by: Georg Ringer <>

History

#1 Updated by Gerrit Code Review 9 months ago

  • Status changed from New to Under Review

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59772

#2 Updated by Markus Klein 9 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#3 Updated by Benni Mack 7 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF