Skip to content

Commit

Permalink
[BUGFIX] Cannot add new address record in TYPO3 v12 PHP 8.2 (#512)
Browse files Browse the repository at this point in the history
* [BUGFIX] Implement safeguard for non-numeric UID in Label.php

The code has been adjusted to handle situations where the UID is not numeric in the Label.php class (e.g. a new record). Instead of directly casting the UID to an integer, it is first checked whether the UID is numeric. If it is not, the row is fetched directly from the parameters. This aims to prevent potential casting errors and provides more robust handling for uid parameters.

Resolves: #511

* Remove unnecessary DebuggerUtility import
  • Loading branch information
MisterMarlu authored Jan 8, 2024
1 parent ec1c85e commit 6dc5661
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Classes/Hooks/Tca/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

/**
* Dynamic label of the address record based on tsconfig
Expand All @@ -30,7 +29,12 @@ public function getAddressLabel(array &$params): void
return;
}

$row = BackendUtility::getRecord('tt_address', (int) $params['row']['uid']);
if (is_numeric($params['row']['uid'])) {
$row = BackendUtility::getRecord('tt_address', (int) $params['row']['uid']);
} else {
$row = $params['row'];
}

$configuration = $this->getConfiguration((int) $row['pid']);
if (!$configuration) {
return;
Expand Down

0 comments on commit 6dc5661

Please sign in to comment.