snowflakech / snowbabel

10 stars 9 forks source link

Error if non-admin user has only one permitted extension #13

Closed tobenschmidt closed 6 years ago

tobenschmidt commented 9 years ago

If a non-admin user with only one permitted extension opens the modul SNOWBABEL -> Translation an error occurs and the list of extensions stays empty:

router
PHP Warning: Invalid argument supplied for foreach() in /PATH/typo3/sysext/core/Classes/Database/DatabaseConnection.php line 836

Reason for this error is the following code inside prepareCommaSeparatedString (snowbabel\Classes\Service\Database.php):

if(is_string($CommaSeparatedString) && strpos($CommaSeparatedString, ',') !== false) {
    $CommaSeparatedString = explode(',', $CommaSeparatedString);
}

$CommaSeparatedString = $this->getDatabaseConnection()->fullQuoteArray($CommaSeparatedString, $Table);

The check for the comma returns false with only one permitted extension. Therefore the following call for fullQuoteArray is not working.

In my opinion the check for the comma is unnecessary and can be removed.