Skip to content

Commit

Permalink
[BUGFIX] Fix install tool updates of user configuration on PostgreSQL
Browse files Browse the repository at this point in the history
This patch fixes DBAL-DriverExceptions on PostgreSQL for updates of the
user configuration by defining the correct parameter type for strings
containing NULL bytes in the update queries.

Resolves: #91468
Releases: 10.4, 9.5
Change-Id: I07661438031e4cee0821657e1f926ac685db371f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64572
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
sgrossberndt authored and bmack committed Aug 4, 2020
1 parent 5466944 commit fc9e845
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ private function getAffectedBackendUsers(): iterable
private function updateBackendUser(int $userId, array $userConfig): void
{
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('be_users');
$connection->update('be_users', ['uc' => serialize($userConfig)], ['uid' => $userId]);
$connection->update('be_users', ['uc' => serialize($userConfig)], ['uid' => $userId], [\PDO::PARAM_LOB, \PDO::PARAM_INT]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ public function executeUpdate(): bool
$queryBuilder->createNamedParameter($backendUser['uid'], \PDO::PARAM_INT)
)
)
// Manual quoting and false as third parameter to have the final
// value in $databaseQueries and not a statement placeholder
->set('uc', serialize($userConfig))
->set('uc', $queryBuilder->createNamedParameter(serialize($userConfig), \PDO::PARAM_LOB))
->execute();
}
}
Expand Down
4 changes: 1 addition & 3 deletions typo3/sysext/install/Classes/Updates/StartModuleUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ public function executeUpdate(): bool
$queryBuilder->createNamedParameter($backendUser['uid'], \PDO::PARAM_INT)
)
)
// Manual quoting and false as third parameter to have the final
// value in $databaseQueries and not a statement placeholder
->set('uc', serialize($userConfig))
->set('uc', $queryBuilder->createNamedParameter(serialize($userConfig), \PDO::PARAM_LOB))
->execute();
}
}
Expand Down

0 comments on commit fc9e845

Please sign in to comment.