Skip to content

Commit

Permalink
[TASK] Robust checks in TceMain
Browse files Browse the repository at this point in the history
In processDatamap_afterDatabaseOperations, return right away if
$table is not a table, this function should handle.

Also use null coalesce when accessing the id in
$parentObject->substNEWwithIDs because there may be some scenarios
where this is not set properly.

Resolves: #190
  • Loading branch information
sypets authored and albig committed May 2, 2024
1 parent 9ddb60f commit fd37af9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Classes/TceMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function processDatamap_afterDatabaseOperations(
array $fieldArray,
DataHandler $parentObject
): void {
// guard statement, abort here if no ods_osm table
if (strpos($table, 'tx_odsosm_') !== 0) {
return;
}
/*
* The id may be integer already or the temporary NEW id. This depends, how the record was created
*
Expand All @@ -55,7 +59,7 @@ public function processDatamap_afterDatabaseOperations(
*/

if ($status == "new") {
$id = $parentObject->substNEWwithIDs[$id];
$id = $parentObject->substNEWwithIDs[$id] ?? '';
}

if (!is_int($id)) {
Expand Down

0 comments on commit fd37af9

Please sign in to comment.