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 9cd92d6 commit 20cbca1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Classes/TceMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ public function processDatamap_afterDatabaseOperations(
array $fieldArray,
DataHandler $parentObject
) {

/**
// 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
*
* case 1:
Expand All @@ -58,7 +61,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 20cbca1

Please sign in to comment.